Move Blog from Subdirectory to New Domain using htaccess

April 11, 2010

Lets say you have wordpress blog sitting in the following domain and directory:

But now, you want to move the blog to:

However, and here is the caveat, you want to maintain all your search engine pages for the blog because currently google is looking at and listing all the pages on and you need to tell google where to look for the moved pages.

Basically this is what you want to do:


All you do is place the code below into a .htaccess file on and all your url’s will move to the new domain in a nice seo friendly manner using 301 redirects.

RewriteEngine on
RewriteBase /
RewriteRule ^blog/(.*)$1 [R=301,L]

This code basically tells everyone that the pages have been moved from site A to Site B and it will keep all the url’s in place meaning you don’t have to make individual 301 redirects.