Friday, January 9, 2009

Apache Redirection

Uncomment below three lines in apache/conf/httpd.conf file:


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


Add below lines lines to httpd.conf:


RewriteEngine on
ProxyRequests Off

Order allow,deny
Allow from all

#Actual Redirection Code Starts
RewriteRule ^/customer-url$ customer-url/ [R]
ProxyPass /customer-url/ http://localhost:8080/customer-url/
ProxyPassReverse /customer-url/ http://localhost:8080/customer-url/


Above we are making apache accept requests on port 80 for a server which is serving web pages on 8080. It mean http://localhost/customer-url gets it's pages from http://localhost:8080/customer-url .

No comments: