Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_rewrite losing parameters

Status
Not open for further replies.

SamBones

Programmer
Aug 8, 2002
3,186
US
I have an Oracle supplied Apache server in front of an Oracle Application Express application server. I want to use mod_rewrite to catch certain Apex apps and send them somewhere else. The incoming URL looks something like this...
Code:
[URL unfurl="true"]http://oldserver/pls/apex/f?p=123[/URL]
The "p=123" is which application in Oracle Apex to run. The problem is, from the logs it seems like the URL/URI is getting chopped off at the question mark, so I have nothing to match the rewrite rule on. That is, this is what I have to match on...
Code:
/pls/apex/f
I've been looking for flags or options to just give me the whole URI to match on, but I can't seem to find it.

Any ideas?
 
OK, I solved my own problem, so I'll share it here with everyone.

I found that I could use the variable "[tt]${QUERY_STRING}[/tt]" to test against everything after the question mark. That is...
Code:
RewriteCond %{QUERY_STRING} ^(.*)p=123:(.*)$ [NC]
RewriteRule ^(.*)$ [URL unfurl="true"]http://newserver/pls/apex/f[/URL] [NC,L,R=301]
This even appends the query string to the rewritten URL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top