Created
May 29, 2017 06:45
-
-
Save Sgouws/b51238941d66b1784a9fd85d8d817806 to your computer and use it in GitHub Desktop.
Useful .htaccess defaults
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
#If the config is not working, it will cause a 500. | |
## 404 | |
ErrorDocument 404 /404.html | |
## basic compression | |
<IfModule mod_gzip.c> | |
mod_gzip_on Yes | |
mod_gzip_dechunk Yes | |
mod_gzip_item_include file \.(html?|txt|css|js)$ | |
mod_gzip_item_include mime ^text/.* | |
mod_gzip_item_include mime ^application/x-javascript.* | |
mod_gzip_item_exclude mime ^image/.* | |
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* | |
</IfModule> | |
## Protect files and directories | |
<FilesMatch "(\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)? |xtmpl)|code-style\.pl|Entries.*|Repository|Root|Tag|Template)$"> | |
Order allow,deny | |
</FilesMatch> | |
## Don’t show directory listings | |
Options -Indexes | |
## Basic rewrite rules, stop unneeded PERL bot, block subversion directories | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteRule ^(.*/)?\.svn/ - [F,L] | |
ErrorDocument 403 "Access Forbidden" | |
RewriteCond %{HTTP_USER_AGENT} libwww-perl.* | |
RewriteRule .* – [F,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment