Skip to content

Instantly share code, notes, and snippets.

@zx1986
Last active December 18, 2015 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zx1986/5719970 to your computer and use it in GitHub Desktop.
Save zx1986/5719970 to your computer and use it in GitHub Desktop.
Apache 301 redirect by .htaccess
## Apache 301 redirect using the .htaccess file
## If one wants to permanently forward an entire web site to a new URL or forward a single page permanently,
## and have the search engines update their database, one should use a 301 redirect.
## This may redirect to a new server or to itself but to a different domain.
## This method is a variation of using the mod_alias redirection shown above
## except that it allows the customer to redirect themselves by providing a .htaccess file themselves.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yolinux.com
RewriteRule ^(.*)$ http://www.yolinux.com/$1 [R=permanent,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment