Forum Moderators: phranque
I'm using the following RewriteRule that works great but it does not seem to process the "?" symbol (it seems to completely ignore it):
RewriteEngine On
RewriteRule ^([a-zA-Z][a-zA-Z])-([a-zA-Z][a-zA-Z])/([^/]+)$ /do.php?cat=$1&cat=$2&cat=$3 [L]
For example, if I go to mysite.com/aa-bb/question?, it processes it as:
do.php?cat1=aa&cat2=bb&name=question
and not:
do.php?cat1=aa&cat2=bb&name=question?
Yet if I go directly to:
mysite.com/do.php?cat1=aa&cat2=bb&name=question?
(without making use of the .htaccess rule), it processes the "?" without problems, so I assume the issue is with the .htaccess RewriteRule.
Any ideas on how I can get it to process the "?" instead of ignoring it? (It also ignores anything AFTER the "?" mark, which I don't want either).
Just to be clear, by "process" I mean that if I go to mysite.com/aa-bb/question? and do a $_GET['name'], I would like it to "get" the "?" symbol as well (e.g. I'd like $_GET['name'] to return "question?" and not just "question".)
Maybe one of these resources will lead us on the right track (I couldn't make too much sense out of them, but they seem relevant):
[ask.metafilter.com...]
[webmasterworld.com...]
[forums.devshed.com...]
[evisibility.com...]
[webmasterworld.com...]
Thanks, I appreciate your help!
vincevincevince also provided the necessary correction to the PHP regex pattern above.
Jim
Jim: I found out what the problem was with the main index form not properly encoding non-standard characters. You were right, it was not the .htaccess, but it was also not the forms (as they were identical). After some thorough analysis, the problem was simply that the main index page did not have any meta character encoding in the html while the do.php page had utf-8 encoding, that's what was messing up the encoding of non-standard chars when the form was sent from the main index page and why it was working when the same form was being sent from do.php.
Jim and Vince (and g1smd), thank you all very much for your help, expertise, and patience. I greatly appreciate it.
I'm very pleased and relieved that we were able to resolve this completely and thoroughly with the best solution possible. Big thumbs up from me. :)