I use mod_rewrite and a .htaccess file with this rules
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
In index.php i echo $_GET['q']
as get(q) and $_SERVER['QUERY_STRING']
as server(qs).
When i acces a pretty URL like ../post/123
it works in get(q) and server(qs) and display: post/123
or type=post&id=123
.
But when i access a URL like ../?type=post&id=1
i get nothing in get(q) but in server(qs). I also have tried
RewriteRule ^(\??)(.*)$ index.php?q=$1 [L,QSA]
in hope that it add an optional questionmark.
EDIT: As an explaination, i want to analyze everything that comes after the trailing slash of the domain. it doesnt matter if its a pretty url or an ugly one i want to handle the behavior in php.
How can i match ugly AND pretty URLS with a .htaccess file?
Thank you