php - 301 redirect in htacess for default language -
i have wordpress site qtranslate plugin. russian language default (ru). have pages: http://example.com/en/xxx http://example.com/ru/xxx (302 redirect http://example.com/xxx) http://example.com/xxx
i need create 301 redirect http://example.com/ru/xxx http://example.com/xxx
i tried write rule in htacess redirection, got redirect loop:
# begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{the_request} ^[a-z]{3,9}\ /index\.html\ http/ rewriterule ^index\.html$ http://example.com.ua/ [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$ http://example.com.ua/ [r=301,l] rewritecond %{http_host} ^www.example\.com.ua$ [nc] rewriterule ^(.*)$ http://example.com.ua/$1 [r=301,l] rewritecond %{request_uri} !^/ru(/|$) rewriterule ^(.*)$ /$1 [r=301] </ifmodule> # end wordpress
try below rule:-
rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.+)$ /ru/$1 [nc,l,qsa]
or
rewriteengine on rewriterule ^ru/(.*)$ /$1 [l,r=301,qsa]
hope work :)
Comments
Post a Comment