Skip to content

Instantly share code, notes, and snippets.

@qutek
Created February 4, 2015 11:48
Show Gist options
  • Save qutek/05c75e8931946d4653d4 to your computer and use it in GitHub Desktop.
Save qutek/05c75e8931946d4653d4 to your computer and use it in GitHub Desktop.
[server] Rewrite old domain to new domain
#rewrite all subdomain on old domain to subdomain on new domain
RewriteCond %{HTTP_HOST} ^(.*)\.olddomain\.com$ [NC]
RewriteRule ^(.*)$ http://%1.newdomain.com/$1 [R=301,L]
# rewrite all links to new domain
RewriteEngine on
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment