0

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?

Thanks

0

2 Answers 2

0

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.

0

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] 
2
  • Hi Dan thanks for the response but unfortunately this hasn't worked Commented Aug 13, 2012 at 16:03
  • I've given you all the tools you need to figure out the exact rule for your situation. Commented Aug 13, 2012 at 16:06

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.