CarlosMaia
CarlosMaia

Reputation: 79

Domain pointing to one server with sub-directory pointing to another

I recently developed a new website for a customer and now it's time to put it online. However, I got one problem:

So, I need a way to point www.example.com to the new machine IP and to point www.example.com/proj to the old machine IP. How can I do this?

Upvotes: 1

Views: 55

Answers (1)

Jon Lin
Jon Lin

Reputation: 143886

The DNS for the example.com domain, change the record to point to the new IP. Then in the new server, make sure mod_proxy is turned on and you can add this to the server/vhost config:

ProxyPass /proj/ http://1.2.3.4/
ProxyPassReverse /proj http://1.2.3.4/

where "1.2.3.4" is the IP address of the old server.

You can do something similar using mod_rewrite in the htaccess file:

RewriteEngine On
RewriteRule ^proj/(.*)$ http://1.2.3.4/$1 [L,P]

Upvotes: 2

Related Questions