Skip to content

Instantly share code, notes, and snippets.

@devyfriend
Created February 12, 2017 08:33
Show Gist options
  • Save devyfriend/d6c655ce47bb505725245cf35fb7d8ce to your computer and use it in GitHub Desktop.
Save devyfriend/d6c655ce47bb505725245cf35fb7d8ce to your computer and use it in GitHub Desktop.
htaccess to force to https
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment