Welcome to WebmasterWorld Guest from 54.147.212.98

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

How do I host part of a website on different server / hosting company?

   
8:10 pm on Dec 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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?

TIA

8:17 pm on Dec 30, 2009 (gmt 0)

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Is it possible to use a subdomain (such as blog.example.com) or does it have to be a subdirectory (example.com/blog)? The former option is much easier to set up than the latter.
9:00 pm on Dec 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I suppose it could be the former if that were easier.
12:51 am on Jan 1, 2010 (gmt 0)

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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 123.123.45.67

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.

10:45 am on Jan 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, encyclo, that's brilliant.