I used the following htaccess code to rewrite url to index.php
It works good with urls as:
http://www.site.com/sub1/
http://www.site.com/sub1/
but not when I add query string to the url like, it breaks:
http://www.site.com/sub1/?uid=7897
http://www.site.com/sub1/?uid=7897
How could I make the code with with query arguments also.
RewriteEngine On # Turn on the rewriting engine
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{QUERY_STRING} !.
RewriteRule ^.+/?$ index.php [QSA,L]
The
QSAflag should be enough to keep the query string alive.So this should work: