Answer the question
In order to leave comments, you need to log in
How to move to a new 301 redirect domain?
The site is currently available at two locations. Two domains refer to the same folder, respectively, and the base on the host
How to redirect all pages to the same ones only on the new domain. Posted the code.
The page returned "too many redirects"
RewriteEngine On
RewriteRule ^(.*)$ https://new-domain.ru/$1 [R=301,L]
Options -Indexes
ErrorDocument 404 /404.php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([^.]*[^/])$ https://old-domain.ru/$1/ [R=301,L]
RewriteCond %{THE_REQUEST} " /index\.(php|html)"
RewriteRule ^index\.(php|html) https://old-domain.ru/ [R=301,L]
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{THE_REQUEST} ^[^?]+// [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://old-domain.ru/$1 [R=301,L]
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"
</IfModule>
# сжатие text, html, javascript, css, xml:
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</ifModule>
# кеш браузера
<ifModule mod_expires.c>
ExpiresActive On
#по умолчанию кеш в 5 секунд
ExpiresDefault "access plus 1 days"
# Включаем кэширование изображений и флэш на месяц
ExpiresByType image/x-icon "access plus 1 month"
ExpiresByType image/jpeg "access plus 4 weeks"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/gif "access plus 43829 minutes"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
# Включаем кэширование css, javascript и текстовых файлоф на одну неделю
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 604800 seconds"
ExpiresByType application/javascript "access plus 604800 seconds"
ExpiresByType application/x-javascript "access plus 604800 seconds"
# Включаем кэширование html и htm файлов на один день
ExpiresByType text/html "access plus 43200 seconds"
# Включаем кэширование xml файлов на десять минут
ExpiresByType application/xhtml+xml "access plus 600 seconds"
# Нестандартные шрифты сайта
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
</ifModule>
Answer the question
In order to leave comments, you need to log in
The page returned "too many redirects"
RewriteEngine On
RewriteRule ^(.*)$ https://new-domain.ru/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?old-domain\.ru$ [NC]
RewriteRule ^(.*)$ https://new-domain.ru/$1 [R=301,L]
https://old-domain.ru
withhttps://new-domain.ru
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question