Last active
November 18, 2015 00:02
-
-
Save sercey/db54066db2515f8bcc7f to your computer and use it in GitHub Desktop.
Yii 2 Basic Force SSL htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mod_Autoindex | |
<IfModule mod_autoindex.c> | |
# Disable Indexes | |
Options -Indexes | |
</IfModule> | |
# Mod_Rewrite | |
<IfModule mod_rewrite.c> | |
# Enable symlinks | |
Options +FollowSymlinks | |
# Enable mod_rewrite | |
RewriteEngine On | |
# SSL redirect | |
RewriteCond %{HTTPS} off | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
# WWW redirect | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
# Frontend redirect | |
RewriteCond %{REQUEST_URI} !^public | |
RewriteRule ^(.*)$ web/$1 [L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment