Tag Archives: htaccess

serve scaled images by htaccess

.htaccess


<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|svg|pdf|flv|mp3)$">
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month 2 days 3 hours"
</IfModule>
</FilesMatch>

Advertisements

add expires headers by htaccess

.htaccess


<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/css "access plus 60 days"
ExpiresByType text/javascript "access plus 60 days"
ExpiresByType image/ico "access plus 60 days"
ExpiresByType image/jpg "access plus 60 days"
ExpiresByType image/jpeg "access plus 60 days"
ExpiresByType image/gif "access plus 60 days"
ExpiresByType image/png "access plus 60 days"
ExpiresByType text/css "access plus 60 days"
ExpiresByType text/html "access plus 60 days"
</IfModule>

Add expires headers from htaccess

.htaccess


<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A300
ExpiresByType application/x-javascript A3600
ExpiresByType text/css A3600
ExpiresByType image/gif A3600
ExpiresByType image/png A3600
ExpiresByType image/jpeg A3600
ExpiresByType text/plain A300
ExpiresByType application/x-shockwave-flash A3600
ExpiresByType video/x-flv A3600
ExpiresByType application/pdf A3600
ExpiresByType text/html A300
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

All in One htaccess

.htaccess


&lt;IfModule mod_deflate.c&gt;
# Insert filters / compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/js
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml

# Ausnahme: Grafiken
SetEnvIfNoCase REQUEST_URI \.(?:gif|jpg|jpeg|png|svg)$ no-gzip dont_vary

# Drop problematic browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
&lt;/IfModule&gt;

## EXPIRES CACHING ##
&lt;IfModule mod_expires.c&gt;
ExpiresActive On
ExpiresDefault &quot;access plus 1 week&quot;
ExpiresByType image/jpg &quot;access plus 1 year&quot;
ExpiresByType image/jpeg &quot;access plus 1 year&quot;
ExpiresByType image/gif &quot;access plus 1 year&quot;
ExpiresByType image/png &quot;access plus 1 year&quot;
ExpiresByType text/css &quot;access plus 1 month&quot;
ExpiresByType text/html &quot;access plus 1 minute&quot;
ExpiresByType text/plain &quot;access plus 1 month&quot;
ExpiresByType application/pdf &quot;access plus 1 month&quot;
ExpiresByType text/javascript &quot;access plus 1 month&quot;
ExpiresByType text/x-javascript &quot;access plus 1 month&quot;
ExpiresByType application/javascript &quot;access plus 1 months&quot;
ExpiresByType application/x-javascript &quot;access plus 1 months&quot;
ExpiresByType application/x-shockwave-flash &quot;access plus 1 month&quot;
ExpiresByType image/x-icon &quot;access plus 1 year&quot;
&lt;/IfModule&gt;
## EXPIRES CACHING ##

#Alternative caching using Apache's &quot;mod_headers&quot;, if it's installed.
#Caching of common files - ENABLED
&lt;IfModule mod_headers.c&gt;
&lt;filesMatch &quot;\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$&quot;&gt;
Header set Cache-Control &quot;max-age=2592000, public&quot;
&lt;/filesMatch&gt;

&lt;filesMatch &quot;\\.(css)$&quot;&gt;
Header set Cache-Control &quot;max-age=2592000, public&quot;
&lt;/filesMatch&gt;

&lt;filesMatch &quot;\\.(js)$&quot;&gt;
Header set Cache-Control &quot;max-age=216000, private&quot;
&lt;/filesMatch&gt;

&lt;filesMatch &quot;\\.(xml|txt)$&quot;&gt;
Header set Cache-Control &quot;max-age=216000, public, must-revalidate&quot;
&lt;/filesMatch&gt;

&lt;filesMatch &quot;\\.(html|htm|php)$&quot;&gt;
Header set Cache-Control &quot;max-age=1, private, must-revalidate&quot;
&lt;/filesMatch&gt;
&lt;/IfModule&gt;

&lt;IfModule mod_headers.c&gt;
&lt;FilesMatch &quot;\.(js|css|xml|gz)$&quot;&gt;
Header append Vary Accept-Encoding
&lt;/FilesMatch&gt;
&lt;/IfModule&gt;

&lt;IfModule mod_gzip.c&gt;
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
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.*
&lt;/IfModule&gt;

# Set Keep Alive Header
&lt;IfModule mod_headers.c&gt;
Header set Connection keep-alive
&lt;/IfModule&gt;

&lt;FilesMatch &quot;\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)(\.gz)?$&quot;&gt;
Header set Expires &quot;Thu, 15 Apr 2022 20:00:00 GMT&quot;
Header unset ETag
FileETag None
&lt;/FilesMatch&gt;

FT booster htaccess

.htaccess

</pre>
# compress text, html, javascript, css, xml:

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

AddType x-font/otf .otf

AddType x-font/ttf .ttf

AddType x-font/eot .eot

AddType x-font/woff .woff

AddType image/x-icon .ico

AddType image/png .png

<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 week"
# Images
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
# CSS
ExpiresByType text/css "access 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
<pre>

Serve scaled images from htaccess in wordpress

.htaccess

</pre>
<IfModule mod_rewrite.c>
# Adaptive-Images -----------------------------------------------------------------------------------

# Add any directories you wish to omit from the Adaptive-Images process on a new line, as follows:
# RewriteCond %{REQUEST_URI} !some-directory
# RewriteCond %{REQUEST_URI} !another-directory

RewriteCond %{REQUEST_URI} uploads

# Send any GIF, JPG, or PNG request that IS NOT stored inside one of the above directories
# to adaptive-images.php so we can select appropriately sized versions
RewriteRule \.(?:jpe?g|gif|png)$ windcompanionwebdesign/wp-content/themes/wcwd-2013/library/adaptive-images.php

# END Adaptive-Images -------------------------------------------------------------------------------
</IfModule>
<pre>

Leverage browser caching from htaccess in wordpress

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType text/html “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”
</IfModule>
## EXPIRES CACHING ##

%d bloggers like this: