adamfowlerit / msportals.io

MSPortals.io - Microsoft Administrator Sites, Training, and Licensing Resources
https://msportals.io/
237 stars 99 forks source link

[FeatureRequest] Redirecting HTTP to HTTPS #202

Closed real-napster closed 1 year ago

real-napster commented 1 year ago

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]

adamfowlerit commented 1 year ago

File created, can you confirm this is correct?

real-napster commented 1 year ago

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]

adamfowlerit commented 1 year ago

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

robdy commented 1 year ago

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

adamfowlerit commented 1 year ago

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