Question

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

Posted May 18, 2018 879 views
WordPressUbuntu 16.04Initial 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

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.

×
1 answer

Hello Jerome,

do you have fixed this issue?

Thank you very much!

Submit an Answer