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

May 18, 2018 822 views
WordPress Ubuntu 16.04 Initial Server Setup

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

1 Answer

Hello Jerome,

do you have fixed this issue?

Thank you very much!

Have another answer? Share your knowledge.

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