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

I've got a blog running on a sub domain mirrored using this method on to a sub directory, so that the links come to my main domain not the sub domain..

Obviously this creates duplicate content. What I was planning on doing, was to block googlebot from seeing the sub domain using robots.txt and then get it to index the sub directory.

What i would also like to do is insert 301 redirects from each of the pages as well as rel="canonical". But because this is a blog there is always new content being added so I would have to add new pages to the 301 each day and add in new rel="canonical" links into each page.

Is there a way to write with the 301 redirect & rel="canonical" that anything after the slash stays the same but the domain name itself will change?

ie.

blog.mysite.com/post1 - would automaticly be redirected to - mysite.com/blog/post1

share|improve this question

1 Answer 1

For 301 redirects using .htaccess it should be easy to do what you want. You could put this in your htaccess file on blog.mysite.com

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

then blog.mysite.com/post1 - would automaticly be redirected to - mysite.com/blog/post1 However, in your case, that would prevent your proxy script from getting to your website.


You could also add canonical tags to your tumblr blog using this method http://ratafia.info/post/78022030/adding-rel-canonical-to-tumblr-themes However, the links would point to blog.mysite.com instead of mysite.com/blog/


Here is what I would actually do. I would point DNS for blog.mysite.com away from tumblr and make sure it redirects to your website (using the rule above). Then, on the machine that does the proxying, use /etc/hosts file to let that machine (and that machine only) map the tumblr ip to the blog.mysite.com name. Then it can still proxy everything, but everybody else on the internet (including googlebot) gets redirected to your blog.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.