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


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello Jerome,

do you have fixed this issue?

Thank you very much!