M
M
Mark2019-02-14 11:41:49
htaccess
Mark, 2019-02-14 11:41:49

How to set up redirects?

Hello!
Please tell me how to make a redirect from gorod.site.ru/contacts to gorod.site.ru/contacts/gorod .
My version:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.+).site.ru$
RewriteRule (.*) http://site.ru/$1?region=%1 [L,R=301,QSA]
%1 - gorod
works, but needs to be completed, it doesn't work(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-02-14
@Mark54

RewriteCond %{HTTP_HOST} ^(?:www\.)?+((.+)\.site\.ru)$
RewriteRule ^(contacts)$ http://%1/$1/%2 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question