Forum Moderators: phranque
http://www.example.com/?any=word to http://www.example.com/word.html RewriteRule ^\?any=(.*)$ http://www.example.com/$1.html [R=301,L] RewriteRule ^index\.php\?any=(.*)$ http://www.example.com/$1.html [R=301,L] RewriteCond %{QUERY_STRING} &?any=([^&]+)&?
RewriteRule ^index\.php$ /%1.html? [R=301,L] http://www.example.com/index.php?any=something -> http://www.example.com/something.html http://www.example.com/?any=something -> http://www.example.com/?any=something
http://www.example.com/?any=something because your rule says that the request must contain index.php and that example URL does not do so. ^(index\.php)?$ and it will then work for index.php there or not. RewriteCond %{QUERY_STRING} (^|&)any=([^&]+)(&|$)
RewriteRule ^(index\.php)?$ http://www.example.com/%2.html? [R=301,L]