Skip to content

Instantly share code, notes, and snippets.

@djom202
Created February 19, 2018 23:42
Show Gist options
  • Save djom202/5241bac341ddc41b43fb23066a9f3530 to your computer and use it in GitHub Desktop.
Save djom202/5241bac341ddc41b43fb23066a9f3530 to your computer and use it in GitHub Desktop.
force ssl and redirect to index.php
RewriteEngine On
RewriteBase /
#if the request is not secure
RewriteCond %{HTTPS} off
#redirect to the secure version
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
#These are your existing rules
RewriteCond %{REQUEST_FILENAME} !.(jpg|jpeg|gif|png|css|js|pl|txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment