Is it possible to rewrite an url with a question a mark in it?
For instance,
http://localhost/mysite/search?tag=mars
to become this,
index.php?url=search&tag[key_name]=mars
I tried with this, but no good at all,
RewriteRule ^search?tag=([a-zA-Z0-9\-]+)/?$ index.php?url=search&tag[key_name]=$1&type=tag [L,QSA]
Any suggestions?
EDIT:
For %1
,
RewriteCond %{QUERY_STRING} (?:^|&)tag=([^&]+)
RewriteRule ^search$ index.php?url=search&tag\%5Bkey_name\%5D=%1&type=tag [L]
Result,
print_r($_GET);
Array
(
[url] => search
[tag] => Array
(
[key_name] =>
)
[type] => tag
)
For %0
,
RewriteCond %{QUERY_STRING} (?:^|&)tag=([^&]+)
RewriteRule ^search$ index.php?url=search&tag\%5Bkey_name\%5D=%0&type=tag [L]
Result,
print_r($_GET);
Array
(
[url] => search
[tag] => Array
(
[key_name] => tag=mars
)
[type] => tag
)