Balconsky February 2016

301 redirect in htacess for default language

I have wordpress site with qtranslate plugin. Russian language is default (ru). I have pages: (302 redirect to

I need to create 301 redirect from to

I tried to write rule in htacess for redirection, but I got redirect loop:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ [R=301,L]
RewriteBase /

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ [R=301,L]
RewriteCond %{HTTP_HOST} ^www.example\$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

RewriteCond %{REQUEST_URI} !^/ru(/|$)
RewriteRule ^(.*)$ /$1 [R=301]


# END WordPress


Ravi Hirani February 2016

Try below rule:-

    RewriteEngine on    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)$ /ru/$1 [NC,L,QSA]


    RewriteEngine On
    RewriteRule ^ru/(.*)$ /$1 [L,R=301,QSA]

Hope it will work for you :)

Post Status

Asked in February 2016
Viewed 1,390 times
Voted 14
Answered 1 times


Leave an answer