Sunday, October 7, 2012

url redirection in apache using proxypass

Sponsored Links
Url redirection in Apache webserver.
Here is a small example of url redirection in Apache using proxypass. I used this when I was using Apache as proxy to Apache tomcat using mod_jk.

you want to forward
www.yourdomain.come/abc to

Here is how you can do it. Open httpd.conf in your favorite editor. Add the following lines.
ProxyPass /abc http://localhost/linux/commands/abc
ProxyPassReverse /abc http://localhost/linux/commands/abc

But while using above solution you may have to give trailing "/" to correct it use the following rewrite rule.
RewriteEngine on
RewriteRule ^/abc$ /abc/ [R]

But for using the above solution you have to load modules mod_proxy and mod_rewrite.
Load the modules, add the rules, restart Apache  You are done. Please suggest if you know any better ways to do it. Remember that all my webapps is in tomcat and Apache is just front end.

Recommended Reading

1. The Definitive Guide to Apache mod_rewrite (Definitive Guides)
2. Apache Cookbook: Solutions and Examples for Apache Administrators
3. .htaccess Handbook
4. .htaccess
5. WordPress For Dummies

Sponsored Links

1 comment:

  1. Its worked thanks..... Expecting still more posts helpful


Be nice. That's all.