Thursday, January 20, 2011

(Invisibly) Rewriting from folder to subdomain

A site currently exists at www.foo.com.

I need to setup a (wordpress) blog at www.foo.com/blog, but on a separate server (with a domain something like blog.bar.com). The site visitors should only see the www.foo.com/blog URL.

So:

User sees                     Target URL
-----------------------       ---------------------
www.foo.com/               -> www.foo.com/
www.foo.com/blog           -> blog.bar.com/ 
www.foo.com/blog/wp-admin/ -> blog.bar.com/wp-admin

This is all do-able using some (a) rewrite rule(s), I'm assuming ?

Does the fact that the blog content will be accessible via 2 completely different URLs cause any problems (especially SEO) ? Is it possible (and desirable), to block access via the blog.bar.com URL ?

  • This is accomplishable using a simple Apache redirect (don't even need rewrite).

    Redirect permanent /blog http://blog.bar.com

    And yes, having the same site accessible via two domains will cause SEO problems.

    Now, I don't know what access you have to the various components, but you could also accomplish similar stuff with DNS by e.g. CNAMING blog.bar.com to www.foo.com and adding a foo.com vhost.

0 comments:

Post a Comment