Forum Moderators: phranque
Searching this forum I found great help to generating rewrite rules to make a dynamic request appear search engine friendly URLs aka?cat1=foo&cat2=bar /foo/bar.
Now my php is being ornery.
Here are my rewrite rules. This is inside of a directory directive:
RewriteRule ^([^/]+)/([^/]+) index.php?state=$1&city=$2 [L]
RewriteRule ^([^/]+) index.php?state=$1 [L]
Now after accessing somehting like [mysite.com...] in PHP when I print out the $_SERVER variable I get two interesting bits of output:
[REDIRECT_QUERY_STRING] => state=AK
[QUERY_STRING] => state=index.php
How on Earth did state get assigned to be index.php? Its not in the original query at all. Do you think some other directive higher up in the site is fiddling with things? I think REDRIECT_QUERY_STRING is an apache cariable. Did apache work correctly and PHP is goofing up.
Thanks in advance if you can straighten me out
Just for grins, I changed my rewrite rules to read:
RewriteRule ^([^/]{2})/([^/]{3,}) index.php?state=$1&city=$2 [L]
RewriteRule ^([^/]{2}) index.php?state=$1 [L]
And the second rule started working! I was very excited at this point! As I started poking around the interface, and checking out Colorado, the only place data is actually entered, I witnessed the following:
[REDIRECT_QUERY_STRING] => state=CO
[REDIRECT_URL] => /secure/flowers/CO
[QUERY_STRING] => state=in
At some point I clicked on the link to Indiana, and now the query string will *not* change. I've even restarted apache.
What is going on?