adamfowlerit/msportals.io

[FeatureRequest] Redirecting HTTP to HTTPS

Closed this issue · 5 comments

Strict Forwarding from HTTP to HTTPS should be set in an .htaccess-File

RewriteEngine On
RewriteCond %{HTTP_HOST} !^msportals.io$ [NC]
RewriteRule ^(.*)$ https://msportals.io/$1 [L,R=301]
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ https://msportals.io/$1 [R=301,L]

File created, can you confirm this is correct?

Is it live already?
If yes it looks like it didn't work. But I also don't know how this works with GitHub hosted pages or which webserver (Apache/nginx) is used.

Alternatively you can try this
https://docs.github.com/en/pages/getting-started-with-github-pages/securing-your-github-pages-site-with-https

Or you can try this:
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Yep it's live - OK I'll try that right now...

robdy commented

Enforce HTTPS in GH Page settings should do the trick without .htaccess. Guide is in the GH Docs article linked by @real-napster

Alright I've removed .htaccess again, it seemed to be breaking the redirect anyway