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]

AngularJS: can’t get html5 mode urls with ui-route $state

This configuration has worked for many of our Apache users using html5mode and ui-router. <VirtualHost *:80> ServerName my-app DocumentRoot /path/to/app <Directory /path/to/app> RewriteEngine on # Don’t rewrite files or directories RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ – [L] # Rewrite everything else to index.html to allow html5 state links RewriteRule ^ index.html … Read more

RewriteCond to match query string parameters in any order

You can achieve this with multiple steps, by detecting one parameter and then forwarding to the next step and then redirecting to the final destination RewriteEngine On RewriteCond %{QUERY_STRING} ^category=([^&]+) [NC,OR] RewriteCond %{QUERY_STRING} &category=([^&]+) [NC] RewriteRule ^index\.php$ $0/%1 RewriteCond %{QUERY_STRING} ^subcategory=([^&]+) [NC,OR] RewriteCond %{QUERY_STRING} &subcategory=([^&]+) [NC] RewriteRule ^index\.php/[^/]+$ $0/%1 RewriteCond %{QUERY_STRING} ^product=([^&]+) [NC,OR] RewriteCond %{QUERY_STRING} … Read more

Reference capture groups of multiple RewriteCond in RewriteRule

You could try constructing the target URL inside the rewrite conditions: RewriteCond ##%{QUERY_STRING} (.*)##(|.*&)param1=([^&]+) RewriteCond %1/%3##%{QUERY_STRING} (.*)##(|.*&)param2=([^&]+) RewriteCond %1/%3##%{QUERY_STRING} (.*)##(|.*&)param3=([^&]+) RewriteCond %1/%3##%{QUERY_STRING} (.*)##(|.*&)param4=([^&]+) RewriteCond %1/%3##%{QUERY_STRING} (.*)##(|.*&)param5=([^&]+) RewriteCond %1/%3##%{QUERY_STRING} (.*)##(|.*&)param6=([^&]+) RewriteRule ^foo$ /bar%1/%3? [L,R] When I try to request: /foo?param1=a&param2=b&param6=3&param3=4&param5=5&param4=6 I get redirected to: /bar/a/b/4/6/5/3 Adding any additional required query string parameters won’t make it look … Read more