skip to Main Content

I just upload my new website, and i would like to do some 301 redirections for the SEO.

My old website had URL like : http://www.myoldwebsite.com/contact/?lang=fr, http://www.myoldwebsite.com/accueil/?lang=fr, http://www.myoldwebsite.com/photos/?lang=fr

I would like to do some redirections :

http://www.myoldwebsite.com/contact/?lang=fr TO http://www.myoldwebsite.com/contacts

http://www.myoldwebsite.com/accueil/?lang=fr TO http://www.myoldwebsite.com/accueil

http://www.myoldwebsite.com/photos/?lang=fr TO http://www.myoldwebsite.com/gallery

I made redirections like this in my .htaccess but it’s impossible to combine several redirections …

RewriteCond %{REQUEST_URI} /contacts/$

RewriteCond %{QUERY_STRING} ^lang=(.*)

RewriteRule (.*) http://www.mywebsite.com/contact/? [R=301,L]

How to make it ?

Thanks a lot 🙂
Have a nice day !

2

Answers


  1. http://www.htaccessredirect.net
    I haven’t give it a try but this might work for you.

    Login or Signup to reply.
  2. It’s easy, you should use multiple RewriteCond conditions in your .htaccess file:

    RewriteEngine on
    
    RewriteCond %{REQUEST_URI} ^.*photos/?
    RewriteRule (.*) /gallery? [R=301,L]
    
    RewriteCond %{REQUEST_URI} ^.*contact/?
    RewriteRule (.*) /contacts? [R=301,L]
    
    RewriteCond %{QUERY_STRING} ^lang=(.*)
    RewriteRule (.*) /$1? [R=301,L]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search