fulldecent / github-pages-template

An opinionated starting point and build system for awesome, collaboratively-edited HTML websites
https://fulldecent.github.io/github-pages-template/
34 stars 50 forks source link

Add .htaccess file for https #4

Closed fulldecent closed 7 years ago

fulldecent commented 7 years ago

Add an .htaccess file that works with Apache and includes instructions for LiteSpeed server, which redirects http to https.

fulldecent commented 7 years ago
RewriteEngine On

# https://www.drupal.org/node/2645198
RewriteRule "^.well-known/acme-challenge" - [L]

# HTTP -> HTTPS
# https://stackoverflow.com/a/4399158/300224
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Redirect www.domain.com -> domain.com
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
fulldecent commented 7 years ago

Done, this is here https://github.com/fulldecent/html-website-template/wiki/How-to-set-up-HTTPS

Linked from README.md