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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you code a Rewrite Rule with escape characters?

Status
Not open for further replies.

mxpilot834

IS-IT--Management
Aug 22, 2006
2
US
I'm on Apache 1.3.19 with no ability to upgrade further, so the No Escape clause won't help me [NE]

My Rewrite Rule is:
Code:
RewriteEngine on
RewriteCond %{THE_REQUEST} /(.*)/AppsLocalLogin\.jsp(.*)prefswitcher(.*)\ HTTP/
RewriteRule ^/(.*)/AppsLocalLogin(.*) /$1/Other_AppsLocalLogin$2 [R,L]

If the url has "prefswitcher" in the string, then change AppsLocalLogin to Other_AppsLocalLogin, otherwise do nothing It mostly works, but $2 (see below) has escape characters (such as %) and mod_rewrite is re-interpreting as %25. I'll give you an example:

"GET /OA_HTML/AppsLocalLogin.jsp?requestUrl=http%3A%2F%2Fserver.domain%3A8051%2FOA_HTML%2Fibuprefswitcher.jsp&cancelUrl=http%3A%2F%2Fcstest10z.cs.na.baesystems.com%3A8051%2Foa_servlets%2Foracle.apps.fnd.sso.AppsLogin&langCode=US&username=LJOHNSTON HTTP/1.1" 302 533

translates to:

"GET /OA_HTML/BAE_AppsLocalLogin.jsp?requestUrl=http%253A%252F%252Fcstest10z.cs.na.baesystems.com%253A8051%252FOA_HTML%252Fibuprefswitcher.jsp&cancelUrl=http%253A%252F%252Fcstest10z.cs.na.baesystems.com%253A8051%252Foa_servlets%252Foracle.apps.fnd.sso.AppsLogin&langCode=US&username=LJOHNSTON HTTP/1.1" 200 5946

Notice the "http%253A" it should retain the %3A and not re-interpret the "%" to %25. Anybody have any suggestions? I'm relatively new to mod_rewrite and REGEX in general.

Thanks in advance,
Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top