Bluehost.com Web Hosting $6.95

mod_rewrite & ampersand

This is a discussion on mod_rewrite & ampersand within the Apache Web Server forums, part of the Web Server and Related Forums category; hello, I need something like that: example.com/a&b/ -> example.com/index.php?x=a%26b or ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-08-2005
febus
 
Posts: n/a
Default mod_rewrite & ampersand

hello,

I need something like that:

example.com/a&b/ -> example.com/index.php?x=a%26b

or

example.com/a%26b/ -> example.com/index.php?x=a%26b

but when I use this rule:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)/$ index.php?x=$1 [L]

I get:

example.com/index.php?x=a&b

there is wrong value of x.

I searched in history and googled but couldn`t find solution.

I think that it must be possible. Anyone now how to do that???

Thanks for any help
  #2 (permalink)  
Old 08-08-2005
HansH
 
Posts: n/a
Default Re: mod_rewrite & ampersand

"febus" <febus@o2.pl> schreef in bericht news:dd7cnr$8fl$1@opal.icpnet.pl...
> I need something like that:
> example.com/a&b/ -> example.com/index.php?x=a%26b
> or
> example.com/a%26b/ -> example.com/index.php?x=a%26b
> but when I use this rule:
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^([^/]*)/$ index.php?x=$1 [L]
>
> I get:
> example.com/index.php?x=a&b
> there is wrong value of x.
>
> I searched in history and googled but couldn`t find solution.
> I think that it must be possible. Anyone now how to do that???

IIRC the value of the query string parameter needs to be
url-encoded. Try -aka test;-)-:
RewrtieMap escape int:escape
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)/$ index.php?x=%{escape:$1} [L]

HansH


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:56 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0