Last active
December 9, 2016 06:50
-
-
Save kas-cor/11ccc5702d7ac4fc8796 to your computer and use it in GitHub Desktop.
Tricks
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
Options All -ExecCGI -Indexes -Includes +FollowSymLinks | |
# php_flag display_errors on | |
# 401-auth | |
AuthType Basic | |
AuthName "Thats protected Area!" | |
AuthUserFile /usr/host/mysite/.htpasswd # https://htmlweb.ru/service/htpasswd.php - generator | |
Require valid-user | |
RewriteEngine On | |
RewriteBase / | |
# Access deny dot files | |
RedirectMatch 403 /\..*$ | |
# Redirect from www to whitout www | |
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC] | |
RewriteRule .* https://%1/$0 [L,R=301] | |
# Redirect from without www to www | |
RewriteCond %{HTTP_HOST} ^([^www].*)$ | |
RewriteRule ^(.*)$ http://www.%1/$1 [L,R=301] | |
# Redirect from http to https | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
# Access Deny | |
Order allow,deny | |
Deny from all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment