Не работает один редирект в Htaccess, помогите
Добавлено: Сб июл 30, 2016 11:19 am
День добрый!
После переезда на новый хостинг, обнаружил, что не работает один редирект " без www http>>www https", все остальные варианты работают.
В файле ничего не менял (кроме заголовка SSL).
Очевидно, что решение простое для специалиста, но не для меня. Кто-то подскажет?
<FilesMatch "\.md5$">
Deny from all
</FilesMatch>
DirectoryIndex index.php
Options -Indexes
# Comment the following line, if option Multiviews not allowed here
# Options -MultiViews
AddDefaultCharset utf-8
<ifModule mod_rewrite.c>
RewriteEngine On
# Uncomment the following line, if you are having trouble
# RewriteBase /
# non-www http >> www https
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^/?(.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# www http >> www https
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# non-www https >> www https
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^/?(.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# www https >> www https
# do nothing
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{THE_REQUEST} !/robots\.txt [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,QSA,L]
# http > https www redirect
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{THE_REQUEST} !/robots\.txt [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,QSA,L]
# http www > https redirect
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{THE_REQUEST} !/robots\.txt [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,QSA,L]
RewriteCond %{REQUEST_URI} !\.(js|css|jpg|jpeg|gif|png)$ [or]
RewriteCond %{REQUEST_URI} apple-touch-icon\.png$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
</ifModule>
После переезда на новый хостинг, обнаружил, что не работает один редирект " без www http>>www https", все остальные варианты работают.
В файле ничего не менял (кроме заголовка SSL).
Очевидно, что решение простое для специалиста, но не для меня. Кто-то подскажет?
<FilesMatch "\.md5$">
Deny from all
</FilesMatch>
DirectoryIndex index.php
Options -Indexes
# Comment the following line, if option Multiviews not allowed here
# Options -MultiViews
AddDefaultCharset utf-8
<ifModule mod_rewrite.c>
RewriteEngine On
# Uncomment the following line, if you are having trouble
# RewriteBase /
# non-www http >> www https
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^/?(.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# www http >> www https
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# non-www https >> www https
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^/?(.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# www https >> www https
# do nothing
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{THE_REQUEST} !/robots\.txt [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,QSA,L]
# http > https www redirect
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{THE_REQUEST} !/robots\.txt [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,QSA,L]
# http www > https redirect
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{THE_REQUEST} !/robots\.txt [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,QSA,L]
RewriteCond %{REQUEST_URI} !\.(js|css|jpg|jpeg|gif|png)$ [or]
RewriteCond %{REQUEST_URI} apple-touch-icon\.png$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
</ifModule>