You are here

Redirect old domain to new domain using .htaccess

Here's a quick snippet of code to keep around if you ever migrate from an old domain to a new domain.

Shown here is what I used to move brantwynn.com to whaaat.com:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^brantwynn.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.brantwynn.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.whaaat.com$
RewriteRule (.*)$ http://whaaat.com/$1 [R=301,L]
</IfModule>

This not only redirects to whaaat.com from brantwynn.com but also bumps off the www. subdomain

Submitted by brant on Thu, 05/10/2012 - 15:30