How to make .htaccess to remove question mark from URL if not ?id=(.*)
?
# Rewrite for ?id=(.*)
RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule .*$ %{REQUEST_URI}%1? [R=301,L]
# It does not work out on this way
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{QUERY_STRING} !^id=.*
RewriteRule .*$ %{REQUEST_URI}%1? [R=301,L]
Does this work?
Tip: during your testings, use 302 redirections instead of 301, as 301 redirections are stored by browsers. You can finally switch to classic 301 when you are done testing.
This would be the right rule:
Update:
If you need
http://site.com/page/?YOURSTRING=blabla
redirected to
http://site.com/page/
then see this link - https://stackoverflow.com/a/15680832/2215124