When Pointing From http//www To https//www Appear Redirect Loop

Hello everyone.

I have some strange issue related to the redirect loop appearing.

For example, my website is in the website general setting I have the same address: in digitalocean domain setting I add that: is posting to IP is posting to the same IP

also in this file 000-default.conf (folder site enabled) I have those lines:

RewriteEngine on RewriteCond %{SERVER_NAME} [OR] RewriteCond %{SERVER_NAME} RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

and in the .httaces file, I have nothing.

**But when I enter to the browser this one I have those redirect chains: ** 301 redirect to 301 redirect to

Somebody could help how to avoid the second unnecessary chain element in order to get the redirect from directly here: and from also directly here

Many thanks


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer


I believe that this might be an issue with your web application itself. You need to make sure that your application URL is setup correctly.

For example if you are using Wordpress you need to make sure that you update your Site and Home URLs as

Or if you are using Laravel for example make sure to set the correct app URL in your .env file.

Let me know how it goes! Bobby

Yesterday I saw that left small issue - from this url don`t work the redirect here:

I use your code:

RewriteEngine on
RewriteCond %{SERVERNAME} [OR]
RewriteCond %{SERVERNAME}
RewriteRule ^ https://www.%1%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

instead my old one:

RewriteEngine on
RewriteCond %{SERVERNAME} [OR]
RewriteCond %{SERVERNAME}
RewriteRule ^ https://%{SERVERNAME}%{REQUESTURI} [END,NE,R=permanent]

So i checked all redirect scenario: - redirect here - redirect here - don`t redirect here - is ok

So as you see this url: don`t redirect here:

Also actually I don`t know related it to this code or not, but also I use the special redirection plugin called “Redirection” for WordPress - I set-upped 301 redirect from the / - main page to another website.

And interesting thing - when I delete this redirect via redirection plugin all seems that works well and all redirection scenaria works well, but when I use the redirection plugin only this one scenario: - don`t redirect here

don`t work.

Tell, please should we customize the code that you provided or the problem in this “Redirection” plugin and could you help with this issue?

Many thanks.