htaccess problems - Passing a "/"

Status
Not open for further replies.

Jeff-DBA

New member
I am trying to pass the url: categories/examplecategories.php?category=$1

using: categories/drinkcategories/(.*).html$

However, the variable that I am passing has a "/" in it. So, lets say I am passing the category AC/DC. When it is urlencoded it looks like..AC+/+DC.

Using (.*) isn't passing the "/" because it thinks that I am opening a new folder and cuts off the DC part, which results in Epic Fail.

Anyone know how to use Regex and .htaccess to pass this "/" through my $_GET variable and change my pages?

Cheers
 


I'm too tired to figure out what exactly you are trying to do but something tells me you just need to catch both like so:

categories/(.*)/(.*).html$ -> categories/whatever.php?category=$1.$2

Remember you can have more than one rewrite rule, one for each setup.
 
If you haven't solved this yet, use rawurlencode() to encode the query string and rawurldecode() on the other side. Converts all non alphanumeric characters to entities.
 
Status
Not open for further replies.