March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

url redirection in apache using proxypass

Url redirection in Apache web server.

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.

Example:
you want to forward
www.yourdomain.come/abc      to www.yourdomain.com/linux/commands/abc

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.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>