Forum Moderators: phranque
Obviously I can't have a search query with a "/" in it, but if I use PHP's urlencode() function, I can have it convert it to the "%2F" hex value.
The problem is, my .htaccess file is still interpreting "%2F" as a straight "/". Is there a way around this? Here's the line I've got right now:
RewriteRule^search/([A-Za-z0-9-]*)/?([A-Za-z0-9\+\%-]*)/?([0-9-]*)/?$ search.php?q=$2&c=$1&p=$3 [L]
How about using this instead:
RewriteRule^search/([A-Za-z0-9\-]+)/([A-Za-z0-[b]9/\+[/b]\%\-]+)/([0-9\-]+)/?$ search.php?q=$2&c=$1&p=$3 [L]
If that won't work in your application, then you'll need to use a RewriteCond to examine %{THE_REQUEST} to get the non-unencoded (original) client request header -- The URL-path 'seen' by RewriteRule is unencoded, which is why it sees "%2f" and "/" as identical. %{THE_REQUEST} is of the form:
GET /search/widgets/furry/green/2 HTTP/1.1-- just as it appears in your raw server logs.
Using %{THE_REQUEST} you'd see the "/" characters and "%2f" character sequences in the URL-path.
Jim