skip to Main Content

I have a problem with an 301 redirection with get parameters.

My old website had URL like this :
http://www.mywebsite.com/contacts/?lang=fr

I upload my new website today. And for the seo i would like to redirect this address to the new : http://www.mywebsite.com/contact

I use this redirection in my htaccess but it doesn’t work ….

RewriteCond %{QUERY_STRING} ^lang=fr$
RewriteRule ^contacts$ http://www.mywebsite.com/contact [L,R=301]

What’s wrong ?
Thanks a lot 🙂

4

Answers


  1. Chosen as BEST ANSWER

    Thanks a lot, it works ! But ... At the same time I would like to te the same redirection with another pages : http://www.mywebsite.com/photos/?lang=fr redirect to http://www.mywebsite.com/gallery

    How to to make it works ? Thanks


  2. Use below rule,

    RewriteCond %{QUERY_STRING} ^lang=fr$ [OR]
    RewriteCond %{REQUEST_URI} ^contacts$
    RewriteRule ^ http://www.mywebsite.com/contact [L,R=301]
    
    Login or Signup to reply.
  3. Try like this, your .htaccess:

    RewriteEngine On  
    RewriteRule ^contacts/?(.*)$ /contact [R=301,QSA,L]
    
    Login or Signup to reply.
  4. Try this:

    RewriteCond %{QUERY_STRING} ^lang=fr$ [OR]
    RewriteCond %{REQUEST_URI} ^contacts$
    RewriteRule ^ http://www.mywebsite.com/contact? [L,R=301]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search