Forum Moderators: phranque
http://www.example.com/index.php?keywords=word
i can now use this
http://www.example.com/index/word
where my rule changes the following parts:
index becomes index.php
/word becomes?keywords=word
and that all works fine except for one circumstance. My problem starts when I allow the keyword search to include currency symbols such as $, £ and €. So that a search for £50 in long format would be:
http://www.example.com/index.php?keywords=£50
(where the browser actually shows http://www.example.com/index.php?keywords=%A350) and is in my simpler format is
http://www.example.com/index/£50
However this does not work as I cannot get the rule to recognise the currency symbol. I am using apache 1.3. Here is my rule
RewriteRule ^(.*)(index)/(.*)$ $1$2.php?keywords=$3 [R]
If anyone has any ideas I'd appreciate the help.
[edited by: jdMorgan at 9:54 pm (utc) on Sep. 30, 2005]
[edit reason] example.com [/edit]
Please be more specific: What happens when this URL is requested? Error message in the browser? What appears in your server access and error logs?
Also, you are exposing your script by doing a 302 redirect instead of an internal rewrite, which defeats the purpose of 'friendly' URLs. I'd recommend:
RewriteRule ^(.*index)/(.*)$ /$1.php?keywords=$2 [NE,L]
http://www.example.com/index/£50
gives a page not found error i.e. my rewrite rules are not matching it (because of the £) so the server just doesn't find a page. The external redirect doesn't matter too much as I want to use the "friendly" urls on other sites linking to mine and sometimes my pages don't find their images or stylesheets even though I am using RewriteBase directives.
At the moment I am using a workaround. Instead of £ symbol I use GBP in my links e.g.
http://www.example.com/index/GBP50
and I am sucessfully matching the GBP fine.