Forum Moderators: phranque
It fails to redirect www requests with appended port numbers
Are you trying to get rid of the queries entirely, or just change to different ones?
!^(www\.example\.com)?$ instead. I want to get rid of everything after the / that is dynamically created.
For non-www/www redirect use this pattern: !^(www\.example\.com)?$ instead.
After the slash or after the question mark? Slash would be removing "path" elements. Question mark would be "query string".
will this do both the non-www/www redirect, remove any and all parameters, and not create an infinite redirect loop? (the +++ are mine - do not want to create a false link)
You'll need a RewriteCond testing QUERY_STRING or THE_REQUEST to make sure the original request did have an appended query string. To be clear, if you accidentally redirect "without query string" to "without query string", you will end up with an infinite redirect loop.
http://www.example.com
http://www.example.com/
http://www.example.com/index.html
http://www.example.com/index.php
http://www.example.com/folder1/folder2/folder3/filename.html
Wasn't that fun?