Tag Archives: move blog to new domain

Move Blog from Subdirectory to New Domain using htaccess

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 domainA.com/blog and you need to tell google where to look for the moved pages.

Basically this is what you want to do:

OLD SITE: http://www.domainA.com/blog/cat-stories
NEW SITE: http://www.domainB.com/cat-stories

All you do is place the code below into a .htaccess file on http://www.domainA.com/blog/ 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/(.*) http://www.domainB.com/$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.