E
E
Edward2021-03-23 10:56:39
Apache HTTP Server
Edward, 2021-03-23 10:56:39

Why is there a redirect from HTTPS to HTTPS?

Good afternoon everyone. There is a website on the VP, an SSL certificate is connected. I do a redirect from http to https, I get a loop of redirects from https to https. This also happens if you change the url of the site from http to https. If you do not redirect http and https work fine. What could be the problem, has anyone experienced this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Edward, 2021-03-23
@EdOther

Thank you all for your help. Found a solution in this article - https://www.digitalocean.com/community/questions/r...
Used this .htaccess

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Z
Zettabyte, 2021-03-23
@Zettabyte

Most likely, the .htaccess condition check is missing before the redirect, or it is written incorrectly.
Something like this (this is an example, the working version for your case may differ):
RewriteCond %{HTTPS} !=on

V
Viktor Taran, 2021-03-23
@shambler81

1. on the Internet, including a toaster, there are about 22 ways to redirect to .haccess, choose your own (they are all correct, but due to the peculiarities of your web server configuration settings, they may not work or lead to a cycle, especially if you have nginx + apache )
2. instead variable where to substitute the explicit site
3. look at the chain of redirects what exactly does not suit him,
for example https://site.ru:80 > https://site.ru:80 and so on.
you can see it here https://bertal.ru/index.php?a566754
4. also don't forget that you need to change the settings in the wordpress itself
wordpress-https-settings.jpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question