I'm not sure if this will work for anyone else in the world except me, since mod_rewrite is such a tricky beast (and apparently powered by voodoo).
I managed to mask the JSP on my site which was something like:
http://www.mysiteblahblah.com/doSomethingGood.jsp?type=reallygood
to
http://www.mysiteblahblah.com/doSomethingGood/ReallyGood.html
Simple! I thought. Mod_rewrite can handle this; before I was hit with:
"You don't have permission to access /doSomethingGood/ on this server"
So I searched around the web here and there and found out that you need to 'enable' mod_proxy. So I did, by uncommenting the line in my httpd.conf:
LoadModule proxy_module modules/mod_proxy.so
I still had the same problem though and looking through my Rewrite Log (which was set to loglevel 3) everything seemed normal and the only meaningful message was "go-ahead with proxy request proxy." So all seemed fine even though it wasn't working.
After another round of searches I just tried my luck and uncommented all other modules that are related to mod_proxy. Lo' and behold, it all began to work:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
Now my virtualhost tag looks something like:
<VirtualHost *>
DocumentRoot "D:\website\webapps\mySiteBlahBlah"
ServerName www.mysiteblahblah.com
# SECTION FOR MOD_REWRITE
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRAC(E|K)
RewriteRule .* - [F]
RewriteRule /doSomethingGood/([A-Z]+).html http://www.mysiteblahblah.com/doSomethingGood.jsp?type=$1 [proxy,QSA]
RewriteLog "D:\Program Files (x86)\Apache Group\Apache2\logs\mod_rewrite.log"
RewriteLogLevel 1
# END OF SECTION FOR MOD_REWRITE
</VirtualHost>
I hope this helps at least someone out there.
Many thanks to all these sites for helping me along:
WebMasterWorld.com
FluidThoughts.com
JSW4.net
Nabble.com
ChinaUnix.net
Apache: mod_rewrite documentation
Apache: mod_proxy documentation
No comments:
Post a Comment