Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DNS- Route DNS for subfolder to different server?

LEt's say I want to have a subfolder called- http://www.foo.com/news/ but I actually want that news folder on a different server. I realize it can be done easily with subdomains, but I was really hoping for the subfolder thing.

Is it possible? How?

like image 734
user18010 Avatar asked Sep 18 '08 17:09

user18010


People also ask

How do I point a domain to a subfolder?

Click "Add Domain." Enter the new domain name in the field marked "Domain," and enter the sub-folder that will contain the site in the "Folder" field. Click "OK" to complete the process.

Can I use 2 different DNS servers?

At a minimum, you'll need two DNS servers for each Internet domain you have. You can have more than two for a domain but usually three is tops unless you have multiple server farms where you would want to distribute the DNS lookup load. It's a good idea to have at least one of your DNS servers at a separate location.


3 Answers

The only real way to it is with a reverse proxy ( Or a webserver acting as a reverse proxy ) between you and the outside world that knows what IP address each folder is in.

Its not possible to just make something, for example have google.com appear at http://foobar.com/google/ because the browser won't route to the IP address ( lack of information ).

You can fake that effect with a fullpage IFrame or Other frameset system, but that's rather dodgy.

If you are using apache, you can set this up with mod_proxy. More details can be found here:

  • Mod_Proxy(1.3) Manual
  • Mod_Proxy(2.0) Manual
  • Apache Tutor.org guide
like image 111
Kent Fredric Avatar answered Nov 05 '22 22:11

Kent Fredric


For Apache the following entries in httpd.conf are needed:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

ProxyPass /news http://newsserver.domain.com/news
ProxyPassreverse / http://newsserver.domain.com/

like image 3
boes Avatar answered Nov 05 '22 22:11

boes


Yes, there is a setting in IIS which lets you point a subfolder to a different site. So make the sub folder a virtual directory on your site, and then in the properties of the virtual directory choose the option for 'A redirection to a URL'... in it specify your other site.

Of course, this is assuming your are using IIS. There should be something similar available to use in whatever web server you are using.

like image 1
Vaibhav Avatar answered Nov 05 '22 23:11

Vaibhav