How do i make when the QUERY_STRING matches something it might use that rule?

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteRule ^(.*)/?$ index.php?uri=$1 [L,QSA]

RewriteCond %{QUERY_STRING} uri=admin
ReqriteRule ^admin\?(.*)/?$ index.php?uri=admin&q=$1 [L,QSA]

Eg. http://localhost/admin?poll/new Following the ? ought to be the paramater q, the the query could be uri=admin&q=poll/new

Any idea how I possibly could do that?


Well, it takes place that the issue is simpler compared to link I gave you while you don't want any analysis around the query string content.

If you are using this single line:

RewriteRule ^admin index.php?uri=admin&q= [L,QSA]

Where QSA mean append the query string towards the result. You'll get the internal redirection to:


Which isn't OK, the reason being how you use argument (admin?poll/new) isn't the standard way. Therefore it appears we'll have to capture the query string content and set it manually around the rewriteRule. This will work (if you want it just for /admin url):

RewriteCond %{REQUEST_FILENAME} admin [NC]
RewriteCond %{QUERY_STRING} (.*) [NC]
RewriteRule .* index.php?uri=admin&q=%1 [L]

Where %1 may be the first parenthesis match within the RewriteCond :(.*), meaning my way through the query string, the query string being anything following the question mark. So actually this enables admin?poll/new but additionally admin?poll/new&foo=toto, giving index.php?uri=admin&q=poll/new&foo=bar