Skip to content

Instantly share code, notes, and snippets.

@jpolete
Created January 29, 2014 22:34
Show Gist options
  • Save jpolete/8698612 to your computer and use it in GitHub Desktop.
Save jpolete/8698612 to your computer and use it in GitHub Desktop.
Starter .htaccess file
# Set +FollowSymLinks otherwise mod_rewrite results in a forbidden error
Options +FollowSymLinks
<IfModule mod_rewrite.c>
# Uncomment to turn on mod_rewrite
# RewriteEngine On
# RewriteBase /
# Uncomment for Wordpress Pretty URLs
# RewriteRule ^index\.php$ - [L]
# Uncomment to strip timestamp (cache buster) from asset filename
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]
# Uncomment for Wordpress Pretty URLs
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule . /index.php [L]
</IfModule>
# Override some PHP defaults
<IfModule mod_php5.c>
# Modify file upload limits
# php_value post_max_size 28M
# php_value upload_max_filesize 28M
# php_value memory_limit 500M
# Set mail-related settings
# php_value SMTP localhost
# php_value smtp_port 25
# php_value sendmail_from no-reply@example.com
# Send mail to catchmail (get catchmail path with `which catchmail`)
# http://berk.es/2011/05/29/mailcatcher-for-drupal-and-other-php-applications-the-simple-version
# php_value sendmail_path /usr/bin/env /Users/jasonpolete/.rvm/gems/ruby-1.9.3-p194@global/bin/catchmail
</IfModule>
# Far Future Expires Header
# http://www.particletree.com/notebook/automatically-version-your-css-and-javascript-files/
# http://httpd.apache.org/docs/2.4/mod/mod_expires.html
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType application/javascript "access plus 6 months"
ExpiresByType image/jpg "access plus 6 months"
ExpiresByType image/jpeg "access plus 6 months"
ExpiresByType image/gif "access plus 6 months"
ExpiresByType image/png "access plus 6 months"
ExpiresByType text/css "access plus 6 months"
</IfModule>
# Deflate config (Apache 2)
# https://www2.suresupport.com/faq.php/2/554
<IfModule deflate_module>
AddOutputFilterByType DEFLATE text/css text/csv text/html text/plain text/richtext text/sgml text/tab-separated-values application/javascript application/x-javascript httpd/unix-directory
AddOutputFilter DEFLATE html htm shtml php php4 pl rb py cgi css js txt
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment