mvladk/sipml5/master/.htaccess - Htaccess File

mvladk/sipml5/master/.htaccess

# # Possible apache configuration needed
# sudo a2enmod expire
# sudo a2enmod headers

<IfModule mod_headers.c>
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=3153600, public"
</FilesMatch>

# 2 DAYS
<FilesMatch ".(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>

# 2 HOURS
<FilesMatch ".(html|htm)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>
</IfModule>

# expiry settings
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/css "access plus 1 hour"
# ExpiresByType text/plain "access 2 days"
# ExpiresByType text/xml "access 2 days"
# ExpiresByType application/xml "access 2 days"
ExpiresByType image/svg+xml "access 2 days"
ExpiresByType application/rss+xml "access 1 month"
ExpiresByType application/x-javascript "access 2 days"
ExpiresByType application/x-shockwave-flash "access 1 month"
# ExpiresByType application/xhtml+xml "access 1 day"
# ExpiresByType application/x-httpd-fastphp "access 1 day"
# ExpiresDefault "access 2 days"
# ExpiresByType text/html "access 1 day"
# ExpiresByType application/x-httpd-php "access 1 day"
# ExpiresByType text/html "modification 1 minute"
# ExpiresByType application/x-httpd-php "modification 1 minute"
</IfModule>

# < IfModule mod_deflate.c>
# compress all
# SetOutputFilter DEFLATE

# compress all text & html:
# AddOutputFilterByType DEFLATE text/plain
# AddOutputFilterByType DEFLATE text/html
# AddOutputFilterByType DEFLATE text/css
# AddOutputFilterByType DEFLATE text/xml
# AddOutputFilterByType DEFLATE application/xhtml+xml
# AddOutputFilterByType DEFLATE application/xml
# AddOutputFilterByType DEFLATE application/xhtml+xml
# AddOutputFilterByType DEFLATE application/xml
# AddOutputFilterByType DEFLATE application/rss+xml
# AddOutputFilterByType DEFLATE application/atom_xml
# AddOutputFilterByType DEFLATE application/javascript
# AddOutputFilterByType DEFLATE application/x-javascript
# AddOutputFilterByType DEFLATE application/x-httpd-php
# AddOutputFilterByType DEFLATE application/x-httpd-fastphp
# AddOutputFilterByType DEFLATE application/x-httpd-eruby
# AddOutputFilterByType DEFLATE image/svg+xml

# Or, compress certain file types by extension:
# <files *.html,*.js>
# SetOutputFilter DEFLATE
# < /files>
# < /IfModule>

# <Location />
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI 
.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
# </Location>

# init rewrite
DirectoryIndex index.php
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
        # DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
</IfModule>
# END W3TC Browser Cache
# 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

On Github License

Files

Download PDF of Htaccess file
DEFLATE, no-gzip, REQUEST_FILENAME, REQUEST_URI

Comments

Apache