Re: RewriteMap issue - Escaping a space

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

 



Hi Joshua.

Worked like a dream. Thanks.

Andrew.

On 19/07/07, Joshua Slive <joshua@xxxxxxxx> wrote:
On 7/19/07, Andrew Dixon <andrew@xxxxxxxxxxxxxxxxx > wrote:

> I tried using the THE_REQUEST, but that get a space in it as well as it
> gives:
>
> GET /sub_page.cfm/title/Paris
> Outbound/section/General/editID/337
>
> And there is space between the GET and the URI. I also tried several of the
> other variables, REQUEST_URI and REQUEST_FILENAME, but they either contain
> the space or not the whole string. The rewrite rules are:
>
> RewriteMap theMap txt:/tmp/theMap.txt
>  RewriteCond ${theMap:$1¦NotFound} !NotFound
> RewriteRule ^/(.*) ${theMap:$1} [R=301,L]

My other idea was something like the following:

RewriteRule "(.*) (.*)" $1SPACE$2
RewriteCond ${theMap:$1¦NotFound} !NotFound
RewriteRule ^/(.*) ${theMap:$1} [R=301]

And, of course, in your map file you would need to replace any space
with the string SPACE. (Again, you'll need to check the rewriteLog to
see how to actually do that first match. It is possible that you need
to match against %20 rather than a raw space. I've never tried it.)
And another caveat: this will only work for one space in the URL. You
could add more RewriteRules to get more spaces, and could probably
handle an arbitrary number with some added complication.

Joshua.

---------------------------------------------------------------------
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