Forum Moderators: phranque
I'm tryinng to setup a re-write on my devleopment server and I'm having a bit of trouble. Here is the re-write I've written:
RewriteRule artistmain/(.*)/(.*)/$ [domain.com...] [PT,QSA]
In the rewrite logs I get the following:
192.168.2.102 - - [20/Nov/2007:11:27:18 --0500] [www.domain.com/sid#4feb40][rid#5a8658/initial] (2) init rewrite engine with requested uri /artistmain/artist/INS30011/
192.168.2.102 - - [20/Nov/2007:11:27:18 --0500] [www.domain.com/sid#4feb40][rid#5a8658/initial] (3) applying pattern 'artistmain/(.*)/(.*)/$' to uri '/artistmain/artist/INS30011/'
192.168.2.102 - - [20/Nov/2007:11:27:18 --0500] [www.domain.com/sid#4feb40][rid#5a8658/initial] (2) rewrite /artistmain/artist/INS30011/ -> [domain.com...]
192.168.2.102 - - [20/Nov/2007:11:27:18 --0500] [www.domain.com/sid#4feb40][rid#5a8658/initial] (3) split uri=http://www.domain.com/search/artistmain.jsp?artist=INS30011 -> uri=http://www.domain.com/search/artistmain.jsp, args=artist=INS30011
192.168.2.102 - - [20/Nov/2007:11:27:18 --0500] [www.domain.com/sid#4feb40][rid#5a8658/initial] (2) implicitly forcing redirect (rc=302) with [domain.com...]
192.168.2.102 - - [20/Nov/2007:11:27:18 --0500] [www.domain.com/sid#4feb40][rid#5a8658/initial] (2) forcing 'http://www.domain.com/search/artistmain.jsp' to get passed through to next API URI-to-filename handler
Not sure why this is happening. Or why I get the "passwed through to next AP URI-to-filename hanler" message.
Any help would be much appreciated!
Thanks,
Paul
Why what, specifically, is happening?
> Or why I get the "passed through to next AP URI-to-filename handler" message.
That's from the [PT] flag on your rule.
The default behaviour of mod_rewrite is to act as a URL-to-filename translator. If you wish to use other URL-to-filename translators, such as mod_alias or mod_proxy, it is necessary to force mod_rewrite to output a URL instead of a filepath. This is the function of the [PT] flag.
The 302 redirect is due to the presence of the HTTP protocol and domain name in your substitution URL.
Just guessing what you're trying to do here, the following could be used to rewrite the URL internally, and then pass it to mod_proxy to send the request to your JSP back-end:
RewriteRule artistmain/([^/]+)/([^/]+)/$ /artistmain.jsp?$1=$2 [PT,QSA]
Jim