-
-
Save kostasxyz/cc46117c6c65328e6a5f4f9e084f5e1b to your computer and use it in GitHub Desktop.
Boilerplate .htaccess from Paul Irish with WordPress added
This file contains hidden or 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
| # BEGIN WordPress | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteBase / | |
| RewriteRule ^index\.php$ - [L] | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule . /index.php [L] | |
| </IfModule> | |
| # END WordPress | |
| # Novel =========== | |
| #Disable Etags | |
| <IfModule mod_headers.c> | |
| Header unset Etag | |
| Header set Connection keep-alive | |
| </IfModule> | |
| FileETag None | |
| Options -Indexes | |
| # Block WordPress xmlrpc.php requests | |
| <Files xmlrpc.php> | |
| order deny,allow | |
| deny from all | |
| </Files> | |
| <files ~ "^.*\.([Hh][Tt][Aa])"> | |
| order allow,deny | |
| deny from all | |
| satisfy all | |
| </files> | |
| # Block WordPress xmlrpc.php requests | |
| <Files xmlrpc.php|wp-config.php> | |
| order deny,allow | |
| deny from all | |
| </Files> | |
| # BEGIN block author scans | |
| RewriteEngine On | |
| RewriteBase / | |
| RewriteCond %{QUERY_STRING} (author=\d+) [NC] | |
| RewriteRule .* - [F] | |
| # END block author scans | |
| # START EXPIRES CACHING # | |
| ExpiresActive On | |
| ExpiresByType text/css "access 1 month" | |
| ExpiresByType text/html "access 1 month" | |
| ExpiresByType image/gif "access 1 year" | |
| ExpiresByType image/png "access 1 year" | |
| ExpiresByType image/jpg "access 1 year" | |
| ExpiresByType image/jpeg "access 1 year" | |
| ExpiresByType image/x-icon "access 1 year" | |
| ExpiresByType application/pdf "access 1 month" | |
| ExpiresByType application/javascript "access 1 month" | |
| ExpiresByType text/x-javascript "access 1 month" | |
| ExpiresByType application/x-shockwave-flash "access 1 month" | |
| ExpiresDefault "access 1 month" | |
| # END EXPIRES CACHING # | |
| # BEGIN Cache-Control Headers | |
| <ifModule mod_headers.c> | |
| <filesMatch ".(json|ico|pdf|flv|jpg|jpeg|png|gif|svg|js|css|swf)$"> | |
| Header set Cache-Control "max-age=2628000, public" | |
| </filesMatch> | |
| <filesMatch "\.(x?html?|php)$"> | |
| Header set Cache-Control "private, must-revalidate" | |
| </filesMatch> | |
| </ifModule> | |
| # END Cache-Control Headers | |
| # BEGIN Turn ETags Off | |
| FileETag None | |
| # END Turn ETags Off | |
| <IfModule mod_deflate.c> | |
| # Compress HTML, CSS, JavaScript, Text, XML and fonts | |
| AddOutputFilterByType DEFLATE application/javascript | |
| AddOutputFilterByType DEFLATE application/rss+xml | |
| AddOutputFilterByType DEFLATE application/vnd.ms-fontobject | |
| AddOutputFilterByType DEFLATE application/x-font | |
| AddOutputFilterByType DEFLATE application/x-font-opentype | |
| AddOutputFilterByType DEFLATE application/x-font-otf | |
| AddOutputFilterByType DEFLATE application/x-font-truetype | |
| AddOutputFilterByType DEFLATE application/x-font-ttf | |
| AddOutputFilterByType DEFLATE application/x-javascript | |
| AddOutputFilterByType DEFLATE application/xhtml+xml | |
| AddOutputFilterByType DEFLATE application/xml | |
| AddOutputFilterByType DEFLATE font/opentype | |
| AddOutputFilterByType DEFLATE font/otf | |
| AddOutputFilterByType DEFLATE font/ttf | |
| AddOutputFilterByType DEFLATE image/svg+xml | |
| AddOutputFilterByType DEFLATE image/x-icon | |
| AddOutputFilterByType DEFLATE text/css | |
| AddOutputFilterByType DEFLATE text/html | |
| AddOutputFilterByType DEFLATE text/javascript | |
| AddOutputFilterByType DEFLATE text/plain | |
| AddOutputFilterByType DEFLATE text/xml | |
| AddOutputFilterByType DEFLATE application/json | |
| # Remove browser bugs (only needed for really old browsers) | |
| BrowserMatch ^Mozilla/4 gzip-only-text/html | |
| BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
| BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
| Header append Vary User-Agent | |
| </IfModule> | |
| # END Novel =========== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment