Sometimes you are trying to redirect a url http://example.com?id=5 to http://example.com/somepage using Apache mod_rewrite.
The easiest method we have found is to add the ? at the end of your RewriteRule destination URL
For Example:
[pure_message style=”modern-info” icon=”#”]RewriteCond %{QUERY_STRING} ^id=5$ RewriteRule ^/$ /somepage? [R=301, L][/pure_message]
Thats pretty much it, the new destination URL will be free of the query string.
A cool online .htaccess testing tools we found helpful and think might help others figure out what is working and more importantly what is not working when creating an htaccess rule. Give i a try here http://htaccess.madewithlove.be/
The .htaccess testing does not work for all rules but it really is handy.