Answer the question
In order to leave comments, you need to log in
MOD_REWRITE or why redirects don't want to work?
Hello, I'm trying to make rules for redirecting everything to https://
I made it up, but they don't work. More precisely, they work, but not all.
sanremo-dv.ru => https://sanremodv.ru
https://sanremo-dv.ru => not working
https://www.sanremo-dv.ru/blabla => not working
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# RewriteBase /
RewriteCond %{HTTP_HOST} ^sanremo-dv\.ru$
RewriteRule ^(.*)$ https://sanremodv.ru/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.sanremo-dv\.ru$
RewriteRule ^(.*)$ https://sanremodv.ru/$1 [R=301,L]
RewriteCond %{HTTPS_HOST} ^sanremo-dv\.ru$
RewriteRule ^(.*)$ https://sanremodv.ru/$1 [R=301,L]
RewriteCond %{HTTPS_HOST} ^www\.sanremo-dv\.ru$
RewriteRule ^(.*)$ https://sanremodv.ru/$1 [R=301,L]
# RewriteCond %{HTTP_HOST} sanremo-dv\.ru
# RewriteCond %{HTTP_HOST} ^www\.sanremo-dv\.ru$
# RewriteRule ^(.*)$ http://sanremodv.ru/$1 [R=301,L]
# Explicitly disable rewriting for front controllers
# RewriteRule ^/web/app_dev.php - [L]
RewriteRule ^/web/app.php - [L]
# Fix the bundles folder
#RewriteRule ^bundles/(.*)$ /web/bundles/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
# Change below before deploying to production
RewriteRule ^(.*)$ app.php [QSA,L]
# RewriteRule ^(.*)$ /web/app_dev.php [QSA,L]
</IfModule>
Answer the question
In order to leave comments, you need to log in
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$ [OR]
RewriteCond %{HTTP} =on
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question