httpd.conf - apache rewrite rules are not working after adding proxy pass -
i trying rewrite url in apache internally redirect requests apache tomacat
here httpd.conf code
<ifmodule mod_rewrite.c> proxyrequests off proxyvia off proxypreservehost on proxypass / http://localhost:8080/myapp/my.html proxypassreverse / http://localhost:8080/myapp/my.html rewriteengine on rewriterule ^/(.*)/$ http://localhost:8080/myapp/my.html?product=$1 [qsa] </ifmodule>
so trying if enter localhost/myapp should redirect me localhost:8080/myapp/my.html
next if enter url localhost/myapp/8 should redirect internally localhost:8080/myapp/my.html?product=8.
now problem proxypass working absolutely fine. rewrite rule showing 404 error. if remove proxypass code same rewrite rule works shows modified url in browser. want know should place rewriterule make work proxypass , y rewrite rule showing modified urls?
you need add [p]
flag rewriterule
. causes rewriterule
'proxy' same way proxypass
directive does. @ moment rule doesn't make sense. alternatively like:
rewriterule ^/(.*)/$ /myapp/my.html?product=$1 [qsa,pt]
which should cause url rewritten , passed through (this happens because of pt
flag) remaining modules need process uri path, in case proxy module.
fyi terminology wrong, when if enter localhost/myapp should redirect me localhost:8080/myapp/my.html
mean if enter localhost/myapp should proxy localhost:8080/myapp/my.html
. redirect external response cases browser request new url , text in browsers address bar change.
mind you, current configuration, requesting localhost/
proxy localhost:8080/myapp/my.html
. if can specify correct help.
Comments
Post a Comment