Skip to content

Instantly share code, notes, and snippets.

@joshuaadrian
Created February 10, 2015 16:01
Show Gist options
  • Save joshuaadrian/5f8550b5171ed6073403 to your computer and use it in GitHub Desktop.
Save joshuaadrian/5f8550b5171ed6073403 to your computer and use it in GitHub Desktop.
AddDefaultCharset UTF-8
Options +FollowSymLinks
RewriteEngine On
# Add Font mime types
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/js text/php text/css application/javascript application/x-javascript application/vnd.ms-fontobject font/ttf font/otf application/x-font-woff
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
# Set up caching on media files for 1 year (forever?)
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A29030400
Header append Cache-Control "public"
</FilesMatch>
# Set up caching on media files for 1 week
<FilesMatch "\.(gif|jpg|jpeg|png|swf|js|css)$">
ExpiresDefault A604800
Header append Cache-Control "public"
</FilesMatch>
# Set up 2 Hour caching on commonly updated files
<FilesMatch "\.(xml|txt|html)$">
ExpiresDefault A7200
Header append Cache-Control "proxy-revalidate"
</FilesMatch>
# Force no caching for dynamic files
<FilesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>
# 404 REDIRECTS
RedirectMatch 404 ^/README.*
RedirectMatch 404 ^/readme.*
RedirectMatch 404 ^/license.*
RedirectMatch 404 ^/\.git.*
# 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
php_value post_max_size 128M
php_value upload_max_filesize 128M
php_value max_execution_time 6000000
php_value max_input_time 259200
php_value memory_limit 256M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment