Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?


share|improve this question

migrated from stackoverflow.com Aug 13 '12 at 15:06

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

2 Answers 2

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 http://www.domain.fr/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.