Re: [users@httpd] Mod_rewrite - how to do operations on entire URL including query string?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 17, 2005 at 11:02:58AM -0800, Terrence Brannon wrote:
> We are receiving URLS that we need to do two things to:
> 
> 1) First unescape the entire URL including the query string
> 2) Change the question mark in front of the text STRING to its escaped
> version - %3F
> 
> Then take the transformed URL and perform a GET back to the Apache
> server that did the two transformations. 
> 
> The enclosed Perl program does what I described above. However, we do
> not have mod_perl installed on these Apache servers so I have to use a
> mod_rewrite solution.

Like this?

#
# we need access to the internal unescape map for this
RewriteMap unescape int:unescape

#
# if we have an empty query string, stop processing and just pass-thru
RewriteCond %{QUERY_STRING} !^$

#
# unescape the request and query string, stash in %1
RewriteCond ${unescape:%{REQUEST_URI}}\?${unescape:%{QUERY_STRING}} ^(.*)$

#
# we now have two question marks, the one between the URI and the
# full i
# query string, and the unescaped one that was in the query string.  
# Stash everything up to (but not including!) the second '?' in %1
# and everything after the second '?' in %2
RewriteCond %1 ^([^\?]+\?.*)\?(STRING.*)

#
# Rewrite!
RewriteRule ^.* %1\%3F%2 [L]

--n

-- 
<huey> dd of=/dev/fd0 if=/dev/flippy bs=1024
<huey> ^^^ Making Flippy Floppy


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux