htaccess RewriteRule page with query string

You need to match against the %{QUERY_STRING} variable. The query string isn’t part of the match in a RewriteRule:

RewriteCond %{QUERY_STRING} ^who=a$
RewriteRule ^people.php$ /people/?t=leadership [R=301,L]
RewriteCond %{QUERY_STRING} ^who=f$
RewriteRule ^people.php$ /people/?t=faculty [R=301,L]
RewriteCond %{QUERY_STRING} ^who=p$
RewriteRule ^people.php$ /people/?t=students [R=301,L]
RewriteCond %{QUERY_STRING} ^who=r$
RewriteRule ^people.php$ /people/ [R=301,L]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^people.php$ /people/ [R=301,L]

Leave a Comment