How can I mod_rewrite and keep query strings?

You need to add the [QSA] flag (“query string append”)

RewriteRule ^apps/([A-Za-z0-9-_]+)/?$ index.php&app=$1 [L,QSA]

For page 301 redirects with the [R] flag as opposed to internal rewrites like this one, the query string is automatically appended. However, you must force it with [QSA] for the internal rewrite.

Leave a Comment