Msg#: 4051628 posted 8:10 pm on Dec 30, 2009 (gmt 0)
I'm not a noob but it seems like such a basic question that I thought this would be the best place. Mods please move if necessary.
I own several sites. On one of them I wish to setup a blog and for mysite.com/blog/ to be on a different server at a different hosting company. Visitors would still see mysite.com/blog/post-url.htm in their browser but the whole blog would reside elsewhere. And visitors can still browse mysite.com/any-other-page.htm at the current host.
I know how to setup a 301 in htaccess but, obviously, that's not what I'm looking for here. Any advice?
Msg#: 4051628 posted 12:51 am on Jan 1, 2010 (gmt 0)
OK, if you go for the subdomain, then once you have set up the external hosting (as a virtual host or whatever) you simply need to add a new entry in your DNS record for the primary domain which directs traffic requesting the subdomain to the appropriate server.
You have the choice of using an A record or a CNAME: for the A record, you specify the IP address of the subdomain's server:
blog 10800 IN A 188.8.131.52
This is fine if you have a dedicated IP for the subdomain or you are sure the IP address will not change without you being notified well in advance.
The other option, which is not dependent on a particular IP address for the subdomain (thus making the solution more robust than an A record), is to use a CNAME to another subdomain defined for the resource. For example, many hosting companies have an option to access a site via a subdomain of their own domain. You can delegate the DNS to that name:
blog 10800 IN CNAME oddsodsblog.myhostingco.tld.
If finally you decide to go for a subdirectory and not a subdomain, you have to set up a reverse proxy on your primary server to allow requests for the /blog/ subdirectory to be handled by the different server.