Answer the question
In order to leave comments, you need to log in
Redirect from domain to subdomain with path saving?
Hello! There is such a problem. It is necessary that when the "redirect to the subdomain" is triggered by the geolocation of the client, a part of the address after the "slash" remains, for example, the link https://site.ru/licensing/litsenziya-na-sbor-trans... and when triggered, for example, for the Chelyabinsk client, go to address https://chelyabinsk.site.ru/licensing/litsenziya-n... . Now everything throws on the main sub-demena around the city https://chelyabinsk.site.ru
Which way to look?
.htaccess
Options -Indexes
ErrorDocument 404 /404.php
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
<IfModule mod_php5.c>
php_flag session.use_trans_sid off
#php_flag default_charset UTF-8
#php_value display_errors 1
</IfModule>
<IfModule mod_php7.c>
php_flag session.use_trans_sid off
#php_flag default_charset UTF-8
#php_value display_errors 1
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/jpeg "access plus 3 day"
ExpiresByType image/gif "access plus 3 day"
ExpiresByType image/png "access plus 3 day"
ExpiresByType text/css "access plus 3 day"
ExpiresByType application/javascript "access plus 3 day"
</IfModule>
<VirtualHost 1.1.1.1:80>
ServerName site.ru
DocumentRoot /var/www/www-root/data/www/site.ru/public_html
ServerAdmin [email protected]
AddDefaultCharset UTF-8
AssignUserID www-root www-root
CustomLog /var/www/httpd-logs/site.ru.access.log combined
ErrorLog /var/www/httpd-logs/site.ru.error.log
<FilesMatch "\.ph(p[3-5]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<IfModule php5_module>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
#php_admin_value open_basedir "/var/www/www-root/data:."
php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>
<IfModule php7_module>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
# php_admin_value open_basedir "/var/www/www-root/data:."
php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>
<IfModule php_module>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
# php_admin_value open_basedir "/var/www/www-root/data:."
php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>
ServerAlias asbes.site.ru ekaterinburg.site.ru www.asbes.site.ru www.ekaterinburg.site.ru www.site.ru
DirectoryIndex index.php index.html
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
</VirtualHost>
<Directory /var/www/www-root/data/www/site.ru/public_html>
Options +Includes -ExecCGI
<IfModule php5_module>
php_admin_flag engine on
</IfModule>
<IfModule php7_module>
php_admin_flag engine on
</IfModule>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.([A-Za-z0-9_-]*)\.site\.ru
RewriteRule ^(.*)$ https://%1.site.ru/$1 [R,L]
RewriteCond %{HTTP_HOST} ^berdsk\.site\.ru
RewriteCond %{HTTPS} off
RewriteRule (.*) https://berdsk.site.ru/$1 [L,R]
</Directory>
<VirtualHost 1.1.1.1:443>
ServerName site.ru
DocumentRoot /var/www/www-root/data/www/site.ru
ServerAdmin [email protected]
AddDefaultCharset UTF-8
SSLEngine on
SSLCertificateFile "/var/www/httpd-cert/www-root/*.site.ru.crt"
SSLCertificateKeyFile "/var/www/httpd-cert/www-root/*.site.ru.key"
SSLHonorCipherOrder on
SSLProtocol +TLSv1 +TLSv1.1 +TLSv1.2
SSLCipherSuite EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4
<IfModule headers_module>
Header always set Strict-Transport-Security "max-age=31536000; preload"
</IfModule>
AssignUserID www-root www-root
CustomLog /var/www/httpd-logs/site.ru.access.log combined
ErrorLog /var/www/httpd-logs/site.ru.error.log
<FilesMatch "\.ph(p[3-5]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<IfModule php5_module>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>
<IfModule php7_module>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>
<IfModule php_module>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>
SSLCertificateChainFile "/var/www/httpd-cert/www-root/*.site.ru.ca"
ServerAlias asbes.site.ru ekaterinburg.site.ru www.asbes.site.ru www.ekaterinburg.site.ru www.site.ru
DirectoryIndex index.php index.html
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
</VirtualHost>
<Directory /var/www/www-root/data/www/site.ru/public_html>
<IfModule php5_module>
php_admin_flag engine on
</IfModule>
<IfModule php7_module>
php_admin_flag engine on
</IfModule>
<IfModule php_module>
php_admin_flag engine on
</IfModule>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.([A-Za-z0-9_-]*)\.site\.ru
RewriteRule ^(.*)$ https://%1.site.ru/$1 [R,L]
RewriteCond %{HTTP_HOST} ^berdsk\.site\.ru
RewriteCond %{HTTPS} off
RewriteRule (.*) https://berdsk.site.ru/$1 [L,R]
</Directory>
<Directory /var/www/www-root/data/www/site.ru>
Options +Includes -ExecCGI
<IfModule php5_module>
php_admin_flag engine on
</IfModule>
<IfModule php7_module>
php_admin_flag engine on
</IfModule>
<IfModule php_module>
php_admin_flag engine on
</IfModule>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</Directory>
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