Created
August 5, 2021 17:02
-
-
Save Marko97IT/a028edca415eed18cd1463e968a197ad to your computer and use it in GitHub Desktop.
.htaccess SECURITY AND OPTIMIZED
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
## Author: Marko97IT https://github.com/Marko97IT | |
## Last edit: 05 Aug 2021 7:02PM CEST | |
## OPTIONS | |
Options -MultiViews | |
Options +FollowSymLinks | |
Options All -Indexes | |
ServerSignature Off | |
RewriteEngine on | |
## REDIRECT TO WWW | |
RewriteCond %{HTTP_HOST} ^DOMAIN\.COM$ [NC] | |
RewriteRule ^(.*)$ https://www.DOMAIN.COM/$1 [R=301,L] | |
## FORCE SSL | |
RewriteCond %{HTTP_HOST} ^www\.DOMAIN\.COM$ [NC] | |
RewriteCond %{SERVER_PORT} 80 | |
RewriteRule ^(.*)$ https://www.DOMAIN.COM/$1 [R=301,L] | |
## REMOVE INDEX | |
RewriteCond %{THE_REQUEST} ^.*/index\.php | |
RewriteRule ^(.*)index.php$ http://%{HTTP_HOST}/$1 [R=301,L] | |
## PRETTY URLS | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME}.php -f | |
RewriteRule ^(.*)$ $1.php | |
## SPEED IMPROVMENT | |
Header unset ETag | |
FileETag None | |
<IfModule mod_deflate.c> | |
SetOutputFilter DEFLATE | |
AddOutputFilterByType DEFLATE text/plain | |
AddOutputFilterByType DEFLATE text/html | |
AddOutputFilterByType DEFLATE text/xml | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE application/xml | |
AddOutputFilterByType DEFLATE application/xhtml+xml | |
AddOutputFilterByType DEFLATE application/rss+xml | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/x-javascript | |
</IfModule> | |
## SECURITY SETTINGS | |
<IfModule mod_headers.c> | |
CheckSpelling Off | |
Header set Referrer-Policy "no-referrer" | |
Header set X-XSS-Protection "1; mode=block" | |
Header always append X-Frame-Options SAMEORIGIN | |
</IfModule> | |
## 403 HTACCESS HOTLINK | |
<Files .htaccess> | |
Order Allow,Deny | |
Deny from all | |
</Files> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment