i'm trying to to do a 301 redirect for a query string but can't figure it out. This is what it would be if it were a regular 301:

Redirect 301 /vetements/robes-de-grossesse.html?limit=all http://www.domain.fr/vetements/robes-de-grossesse.html

Can anyone advise on how to do it?



This should work:

RewriteCond %{QUERY_STRING} ^limit=
RewriteRule .? %{REQUEST_URI}? [R=301,L]

It will maintain the directory path but the '?' on the end will remove the query string.


Redirect (mod_alias) operates on URL paths only, which does not include the query string. You'll want to use mod_rewrite instead. Something like this:

RewriteCond %{QUERY_STRING} limit=all
RewriteRule vetements/robes-de-grossesse.html http://www.domain.fr/vetements/robes-de-grossesse.html [R=301,L]
  • Hi Dan thanks for the response but unfortunately this hasn't worked – user1595726 Aug 13 '12 at 16:03
  • I've given you all the tools you need to figure out the exact rule for your situation. – Dan Grossman Aug 13 '12 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.