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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
"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 |