Question

ServerPilot Force HTTP:// to redirect to HTTPS:// but HTTP:// should return 301 code but returning code 307 using .htaccess file

I’ve moved my website to use HTTPS using Digital Ocean and ServerPilot with Cerbot for the SSL, I’ve force HTTP:// to move to SSL and non-www to www. by using on the .htaccess file

RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} =domain.com
RewriteRule (.*) https://www.domain.com/$1 [R=301,L]

The issue the old HTTP:// have still the statue code of 307 instead of 301.

Any suggestion to make sure HTTP:// URL return a 301?

Many thanks,

Jerome

Subscribe
Share

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.

Hello Jerome,

do you have fixed this issue?

Thank you very much!