Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Can anyone advise on how to do it?


share|improve this question

migrated from Aug 13 '12 at 15:06

This question came from our site for professional and enthusiast programmers.

up vote 0 down vote accepted

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.

share|improve this answer

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 [R=301,L]
share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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