2

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.

3 Answers 3

2

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.

1

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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.