Migrating WordPress to a New Domain Name

Here’s some code I scrapped together in order to move my WordPress blog from one domain to another. It redirects not only the bare domain, but the paths as well, i.e. specific blog posts, archive links, etc…

You can use this code in your existing .htaccess file that WordPress is using. You can find the original code here.

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^oldsite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.oldsite.com$
RewriteRule (.*) http://newsite.com/$1 [R=301,L]

</IfModule>

Leave a Reply