V
V
Vitaly Mironov2019-09-07 19:56:30
htaccess
Vitaly Mironov, 2019-09-07 19:56:30

How to make htaccess 301 redirect?

I want to make a redirect from a link like site.com/ru/ to ru.site.com
I tried this:

RewriteCond %{HTTP_HOST} ^site.com/ru/
RewriteRule ^$ https://ru.site.com/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} /ru/ [NC]
RewriteRule ^$ https://ru.site.com/ [R=301,L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-09-07
@dodo512

RewriteCond %{HTTP_HOST} ^site\.com$
RewriteRule ^ru/(.*) https://ru.site.com/$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question