Skip to content

Instantly share code, notes, and snippets.

@emhaye
Forked from vielhuber/.htaccess
Created October 3, 2018 07:49
Show Gist options
  • Select an option

  • Save emhaye/2a2e600fa50a5fb5aa6ac2372f15ece3 to your computer and use it in GitHub Desktop.

Select an option

Save emhaye/2a2e600fa50a5fb5aa6ac2372f15ece3 to your computer and use it in GitHub Desktop.
Apache: htaccess force www and https ssl #server
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment