This site is powered by WordPress and when it came online 2 years back for some odd reason I opted to install WordPress on the "blog" sub-domain. I guess it was popular then to have the blog installed on its own domain.
And even though I knew the kind of content I would write, I still opted to use my name for the domain. Something which I can’t change easily now 🙂
venukb.com remained as a dummy entry point and it just used to redirect to
venukb.com/blog. I have always wanted to get rid of the sub-domain and move to the root domain.
I was of the opinion then that the move would affect the Pagerank and hence had held making such a move. After the recent tanking of Pagerank I decided that it was the right moment to make this switch.
I had 2 ways of making this switch:
Method 1 – Changing the Blog Address in WordPress Options
WordPress can power your site’s root and yet can be copied to a separate subdirectory. In my case
blog was the subdirectory and I could quickly switch to root by just changing the Blog Address in the WordPress Options.
You should also update the permalinks and rebuild the sitemap after making the above change.
However Google’s Index and sites linking to your pages would still have "blog" in the URL and this requires you to redirect all those requests to the root domain. I accomplished this easily by adding the following directive in .htaccess file
Redirect 301 /blog https://www.venukb.com
Everything worked fine until I tried to access the WordPress Admin console which was at
venukb.com/blog/wp-admin. Since the
/blog was redirected to root, I was never able to gain access to the admin console and with the
mod_alias directive, there is no way to exclude access to a particular URL.
The only option was to fall back on
mod_rewrite and use RewriteRule in conjunction with RewriteCond. I searched in a lot of forums for putting in the right rewrite directive only to end up in a confused state.
mod_rewrite is a one complex library and regular expression is something which I can probably never understand 🙁
If someone has already done this with mod_rewrite, please let me know as to what directive worked for you
Method 2 – Moving the WordPress contents to the root domain
I gave up on mod_rewrite and moved my entire blog directory including the WordPress core files to the root. With SSH access to the server, this was done in seconds with a
mv command. I also backed up and restored the .htaccess file on the root domain (If you copy the .htaccess residing on the blog sub-domain, you would end up with 500 Internal Server Error)
In addition to Blog Address, I even changed the WordPress Address and as in the previous method, updated permalinks and the sitemap. The mod_alias Redirect directive worked like a charm and I had no issues in accessing the WordPress Admin console.
What else do I need to do ?
The main thing to do after moving to a different domain is to set the permanent redirection (301) and building your sitemap. The pages in your blog might have linked to several other internal pages and all this might point to the "blog" URL’s.
Even though the Redirection will take care of these links, its better off to modify these links.I am considering using the Search Regex WordPress plugin from Urban Giraffe.
If you are using a desktop based client like Windows Live Writer to publish posts, you have to update the account settings.
You might also want to monitor the 404 errors on your server and for this I am again using Urban Giraffe’s Redirection Plugin
Redirection plugin is also a powerful way of setting up Redirects in WordPress and this method totally avoids .htaccess. The author is also testing a beta version of this plugin which modified the .htaccess file itself.
If you also happened to move WordPress across domains, do share your experience.
Comments on this entry are closed.
I always wondered why you use the subdomain. I’m glad you got rid of it 😉
Yup I myself am more than glad that I got rid of it. Fear of Pagerank made be bear the subdomain mess 🙂
Meanwhile RSS readers has tanked thanks to this move 🙂
Subdomains are useful only if you have different services like blogging, forums etc, otherwise I feel there is no use with subdomain.
Should I move mine to the root domain as well? 🙁
I don’t really want to, but is the benefit really that great?
Yes Nirmal, unless you have something is mind for your home page, better not opt for subdomains.
I for one find that visitors will give little importance for a good website being on a “blog” URL. If you are getting “digged” often, I guess even those visitors won’t like this “blog” subdomain !
Its just my analysis and as said earlier, unless you plan to have something on your root, there is no sense having a separate blog domain. Do move as soon as possible 🙂
This “living in fear” shit is getting old.
We recently released the Update URLs plugin which udates all permalinks and content links after a move.
Check it out at: http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/