Answer the question
In order to leave comments, you need to log in
How to make an htaccess 301 redirect from a subdomain to a folder of the same name on the main domain?
There is a construction that redirects from a subdomain (city) in English ( https://city.site.ru/en/ ) to a folder of the same name on the main domain ( https://site.ru/en/city/ ):
RewriteCond %{HTTP_HOST} ^city\.site\.ru$ [NC]
RewriteRule ^en\/$ https://site.ru/en/city/ [R=301,L]
The goal is to make the rule common to all subdomains (cities ), like:
RewriteCond %{HTTP_HOST} ^( moscow|novosib|.... #etc. pieces 50# )\.site\.ru$ [NC]
#depending on which city the user chose
RewriteRule ^ en\/$ https://site.ru/en/ city / [R=301,L]
#and here I stalled, how to get the part about the city from %{HTTP_HOST} RewriteCond and insert instead of "city" into the RewriteRule?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question