mod_rewrite Strip Query String

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

To make your RewriteRule strip the query string, simply append a ? to the end of the rewrite path, eg:


# redirect all requests to a subfolder to the home page
# strips query string
RewriteEngine On
RewriteBase /
RewriteRule ^subfolder/.*$ /index.php? [L,R=301]