A
A
amikolyk2017-12-05 18:03:33
htaccess
amikolyk, 2017-12-05 18:03:33

301 redirect domain.ru -> domain.com with different default languages?

Good afternoon!
Help me write redirect rules something really bad.
domain.ru -> main language Russian
domain.com -> main language English
domain.ru/en = domain.com
domain.com/ru = domain.ru
domain.ru/blog = domain.ru/ru/blog = domain. com/ru/blog != domain.com/blog
domain.com/blog = domain.com/en/blog = domain.ru/en/blog != domain.ru/blog
You need to make a correct 301 redirect of the ru domain to com
domain .ru/en/ -> domain.com/en/
domain.ru/ru/ -> domain.com/ru/
domain.ru -> domain.com/ru/
perhaps another
domain.com -> domain.com rule is needed /en/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lexty, 2017-12-05
@Lexty

I haven’t worked with Apache for a long time, but here’s what I googled

domain.ru/ru/ -> domain.com/ru/
domain.ru/en/ -> domain.com/en/
domain.ru -> domain.com/ru/

<VirtualHost *:80>
  ServerName domain.ru
  Redirect /ru/ http://domain.com/ru/
  Redirect /en/ http://domain.com/en/
  Redirect / http://domain.com/ru/
</VirtualHost>

<VirtualHost *:80>
    ServerName domain.com

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !/ru/
    RewriteCond %{REQUEST_URI} !/en/
    RewriteRule ^(.*)$ /en$1 [R=301,L]
</VirtualHost>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question