.htaccess rewrite URL with a question mark “?”

You need to use %{QUERY_STRING} to capture the query string data:

RewriteCond %{QUERY_STRING} ^view=(.*)$
RewriteRule ^component/users/?$ %1.html? [R=301,L]

The above rule/condition will take the value of the query string view and use it to form your redirect if the path component/users matches.

Leave a Comment