How can I make that if the QUERY_STRING matches something it would 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
After the ? should be the paramater q, the the query would be uri=admin&q=poll/new
Any idea on how I could do this?
Thanks.
Well, it happens that your problem is more simple than the link I gave you as you do not want any analysis on the query string content.
If you use this single line:
Where QSA mean append the query string to the result. You will obtain an internal redirection to:
Which is not OK, this is because the way you use argument (
admin?poll/new) is not the standard way. So it seems we’ll need to capture the query string content and put it by hand on the rewriteRule. This should work (if you need it only for /admin url):Where %1 is the first parenthesis match in the RewriteCond :
(.*), meaning everything in the query string, the query string being anything after the question mark. So in fact this allowsadmin?poll/newbut alsoadmin?poll/new&foo=toto, givingindex.php?uri=admin&q=poll/new&foo=bar