Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

So we originally have our blog on our main domain (for example, it would be on www.example.com). Now we have moved it to http://blog.example.com. My question is how do we change the address from www.example.com to blog.example.com.

I read this >>> http://www.google.com/support/webmasters/bin/answer.py?answer=83106 and it said make sure your site is main not a subdomain but I'm trying to move the site to a subdomain. Help.

share|improve this question
add comment

migrated from stackoverflow.com May 24 '11 at 1:47

This question came from our site for professional and enthusiast programmers.

3 Answers

Set up HTTP 301 redirects from your old blog URLs to the corresponding URLs on the new site. As soon as Google reindexes your site, they'll see that it has moved and update their index. In the mean time, the 301 redirects will also send any visitors going to your old site to the new location.


For example, to set up a 301 redirect from www.example.com/blog to blog.example.com using Apache mod_alias, you should add the following line to your Apache config (or in an .htaccess file) for www.example.com:

Redirect 301 /blog http://blog.example.com

Or you can do the same with mod_rewrite:

RewriteRule ^/?blog(/.*)?$ http://blog.example.com$1 [NS,L,R=301]

If your old blog URLs are so hopelessly mixed with the URLs of your new content on www.example.com that you can't come up with a reasonable number of regexps to match them, one possible solution is to handle the redirection in your 404 error handler. For some examples, see e.g. this article.

share|improve this answer
add comment

www is technically a sub-domain of example.com. You would simply change your DNS reference from www to blog (in your A record). If you are keeping the same location and just changing from www.example.com to blog.example.com, the IP address that the A record points to will be the same. When you change the www sub-domain over to blog, it will start sending traffic to the same location as it used to send your original traffic. Then you just need to be sure that your web server is ready to accept the sub-domain blog.example.com.

share|improve this answer
add comment

Do you have shared hosting or your own DNS server?

If you want keep the www.example.com domain for another site you'll need to add either a new sub-domain in your shared hosting control panel for blog.example.com or add a new A record for this sub-domain on your DNS server.

If you want traffic to www.example.com to auto-redirect to blog.example.com then you could create a CNAME entry instead in your DNS for blog. pointing to www.

You may also have to configure your web server host headers to accept the new sub-domain url as well as your web application if it uses absolute urls.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.