Results 1 to 1 of 1
Hi,
I have two apache servers.
Server1 : 192.168.0.2
Website URL : demo-site1.abc.local
Server2 : 192.168.0.3
Website URL : 192.168.0.3:8083/cars
I want to redirect all traffic which comes to " ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-24-2012 #1Just Joined!
- Join Date
- Dec 2009
- Posts
- 48
URL Redirection in Apache
Hi,
I have two apache servers.
Server1: 192.168.0.2
Website URL: demo-site1.abc.local
Server2: 192.168.0.3
Website URL: 192.168.0.3:8083/cars
I want to redirect all traffic which comes to "demo-site1.abc.local"[192.168.0.2] to the website at the url: 192.168.0.3:8083/cars.
I have read some articles, and found that it can be possible with the mod_rewrite module. I inserted it in my httpd.conf. Here it is:
<VirtualHost *:80>
ServerAdmin root@server.hector.com
ServerName demo-site1.abc.local
RewriteEngine on
RewriteRule /.* http://192.168.0.3:8083/car/ [R]
</VirtualHost>
This works. But redirection changes the url as well. I mean whenever i enter "demo-site1.abc.local" in address bar of browser, it redirects to url "http://192.168.0.3:8083/car/". It means url changes as well. But i don't want the user to know that my website "demo-site1.abc.local" is pointing to "http://192.168.0.3:8083/car/".
After googling a lot, i didn't find the solution. So i moved to another solution which says that i need to configure Reverse proxy in my Apache server. So i did the same. Have a look at my httpd.conf:
<VirtualHost *:80>
ServerAdmin root@server.hector.com
ServerName demo-site1.abc.local
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://192.168.0.3:8083/car/
ProxyPassReverse / http://192.168.0.3:8083/car/
</VirtualHost>
This is what i was looking for so long time. It actually forwards website "demo-site1.abc.local" to "http://192.168.0.3:8083/car/". Which means only forwarding is working and url doesn't changes.
But the only problem i am still facing is that the webpage and other links are not displaying properly[do not load]. Below is the output of 'Firebug' tool which shows whats going on background of the webpage.
GET demo-site1.abc.local 200 OK demo-site1.abc.local 24 KB 192.168.0.2:80
GET jquery-1.5.2.min.js 200 OK code.jquery.com 29.2 KB
GET screen.css;jsessio...BF90F1621156207653 404 Not Found demo-site1.abc.local 0
GET custom.css;jsessio...BF90F1621156207653 404 Not Found demo-site1.abc.local 0
GET 1024.css;jsessioni...BF90F1621156207653 404 Not Found demo-site1.abc.local 0
GET 900.css;jsessionid...BF90F1621156207653 404 Not Found demo-site1.abc.local 0
What do you think what is the problem ?
Thanks....


Reply With Quote
