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

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

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.