homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

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

 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?




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

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)

I suppose it could be the former if that were easier.


 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

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)

Thanks, encyclo, that's brilliant.

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved