htaccess remove (not hide) query string
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/index.php$ [NC,OR]
#RewriteCond %{REQUEST_URI} ^/index.html$ [NC,OR]
#RewriteCond %{REQUEST_URI} ^/index.htm$ [NC,OR]
#RewriteCond %{REQUEST_URI} ^/index$ [NC,OR]
#RewriteCond %{REQUEST_URI} ^/home$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} .
RewriteCond %{QUERY_STRING} !q=
RewriteRule .* /? [R=301,L]
This will redirect all requests like:
http://example.com/index.php?a=b
but will not redirect thouse requests that contains q=, this may be changed to whatever your system uses for human readable urls, wordpress uses p=
in my case, sustem transparently redirect requests like:
http://example.com/home to http://example.com/index.php?q=/home and we will not touch such requests