Answer the question
In order to leave comments, you need to log in
After installing an SSL certificate and switching to HTTPS - error: The site redirected too many times. How to fix?
Site on Laravel on VDS server Debian 10 + Appache2. After installing SSL certificates and switching the site to HTTPS, an error occurs:
The site has redirected too many times. ERR_TOO_MANY_REDIRECTS
Host File
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName site.ru
ServerAlias www.site.ru
ServerAdmin [email protected]
DocumentRoot /var/www/site.ru/public
<Directory /var/www/site.ru/public>
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/site.ru-error.log
CustomLog ${APACHE_LOG_DIR}/site.ru.log combined
SSLEngine on
SSLProtocol all -SSLv2
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/site.ru/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/site.ru/privkey.pem
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
RewriteEngine on
RewriteCond %{SERVER_NAME} =site.ru
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,NE,R=permanent]
</VirtualHost>
</IfModule>
Answer the question
In order to leave comments, you need to log in
All! Problem solved. Perhaps the information will be useful to someone.
The problem was in the features of the hosting where the VDS server was rented - Gino, they provide proxying and port forwarding enabled by default, supposedly for the convenience of users. Which can be simply disabled in the settings.
It’s not very clear why the redirect is left in the ssl part, I would also understand it would redirect from https://www.site.ru to https://site.ru , and looking at the syntax, I see the logic of the following logic (I don’t pretend, guru module rewrite will be corrected) - if SERVER_NAME contains the string site.ru -> redirect to site.ru. (by the way, according to the documentation, the string with "additional syntax" must be quoted)
RewriteEngine on
RewriteCond %{SERVER_NAME} =site.ru
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI } [L,NE,R=permanent]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question