looking through the forums, I found how to permanently redirect a querystring based url to a directory. However, I havent figured out how to reproduce it for every variable/url combination.
For example, when I use the following, it works:
- Code: Select all
RewriteCond %{QUERY_STRING} ^(.*&)?p=1(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/neufs/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/neufs/? [NC,R=301,L]
But if I attempt to repeat the same code for each, only the first one works:
- Code: Select all
RewriteCond %{QUERY_STRING} ^(.*&)?p=1(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/neufs/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/neufs/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=2(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/inventaire/? [NC,R=301,L]
RewriteRule ^fr/index\.php?p=2$ /fr/inventaire/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=3(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/location/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/location/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=14(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/location/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/location/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=4(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/services-et-pieces/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/services-et-pieces/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=5(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/evenements/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/evenements/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=6(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/liens/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/liens/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=7(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/promotions/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/promotions/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=8(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/nous-joindre/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/nous-joindre/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=10(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/neufs/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/neufs/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=12(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/neufs/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/neufs/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=11(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/neufs/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/neufs/? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^(.*&)?p=13(&.*)?$ [NC]
RewriteRule ^index\.php$ /fr/promotions/? [NC,R=301,L]
RewriteRule ^fr/index\.php$ /fr/promotions/? [NC,R=301,L]
What am I doing wrong here?