linuxdnsipserver-responseserver-monitoring

How to have multiple IP address mapped to a single server's files


I have a dedicated linux hosting machine from godaddy. I also have purchased two website domains. Say it is abc.com and xyz.com.

xyz.com is already setup to the server.

I want to get abc.com's traffic to a subfolder of xyz.com but the links must remain as abc.com. i.e abc.com/index.html must be in xyz.com/abc/index.html path. But xyz.com/abc/index.html must return a 404 while abc.com/index.html must return the proper page.


Solution

  • If you are using apache with mod_proxy enabled, configuring a ReverseProxy will do the job. This is an example of the directives to add in abc.com domain's apache configuration:

     ProxyPass / http://xyz.com/subfoder
     ProxyPassReverse / http://xyz.com/subfolder
    

    These will forward all requests to http://xyz.com/subfoder`

    Also have a look to apache's documentation