Do I need to add this in .htaccess file when Cloudflare has the options?

Should I remove this from my .htaccess file?

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

BEGIN Advanced Speed Increaser

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/rss+xml
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
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 font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon

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
#Image Future
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/javascript A2592000
#Turn Off ETags
Header unset ETag
FileETag None

END Advanced Speed Increaser

Header set Connection keep-alive

EXPIRES CACHING

ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/webp "access plus 1 year" ExpiresByType audio/ogg "access plus 1 month" ExpiresByType video/mp4 "access plus 1 month" ExpiresByType video/ogg "access plus 1 month" ExpiresByType video/webm "access plus 1 month" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType text/x-component "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 2 days" ExpiresByType application/atom+xml "access plus 1 hour" ExpiresByType application/rss+xml "access plus 1 hour" ExpiresByType application/font-woff "access plus 1 month" ExpiresByType application/vnd.ms-fontobject "access plus 1 month" ExpiresByType application/x-font-ttf "access plus 1 month" ExpiresByType font/opentype "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month" ## EXPIRES CACHING ##

Cache control headers. Tells browser how to handle file caching

Header set Cache-Control "public" Header set Cache-Control "public" Header set Cache-Control "private" Header set Cache-Control "private, must-revalidate" Header set Last-Modified "Mon, 31 Aug 2000 00:00:00 GMT"

AMPFORWPLBROWSERCSTART Browser Caching

ExpiresActive On AddType application/vnd.ms-fontobject .eot AddType application/x-font-ttf .ttf AddType application/x-font-opentype .otf AddType application/x-font-woff .woff AddType image/svg+xml .svg ExpiresByType application/vnd.ms-fontobject "access 1 year" ExpiresByType application/x-font-ttf "access 1 year" ExpiresByType application/x-font-opentype "access 1 year" ExpiresByType application/x-font-woff "access 1 year" ExpiresByType image/svg+xml "access 1 year" ExpiresByType image/webp "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType image/x-icon "access 1 year" ExpiresByType text/css "access 3 month" ExpiresByType text/javascript "access 3 month" ExpiresByType text/html "access 3 month" ExpiresByType application/javascript "access 3 month" ExpiresByType application/x-javascript "access 3 month" ExpiresByType application/xhtml-xml "access 3 month" ExpiresByType application/pdf "access 3 month" ExpiresByType application/x-shockwave-flash "access 3 month" ExpiresDefault "access 3 month" # END Caching AMPFORWPLBROWSERCEND

I see there are two types of mechanisms you have there: 1. GZIP compression and 2. Cache Headers. You should keep them.

Compression
Although Cloudflare will GZIP all files (that can be compressed) to the visitor for you, Cloudflare still needs to pull these files from your origin server. Therefore, files should also be served with compression from the origin server, so they are passed as fast as possible to Cloudflare.

Cache headers
If you haven’t specified cache headers from your server, Cloudflare might add a default “4 hours”. Most cacheable files (js, css, images) should have an expire time set to far into the future (1 year +) because they don’t generally change. If you set cache headers from your own server, they prompt Cloudflare to respect existing cache headers. Having cache headers set far into the future, will allow visitors browsers to effectively cache files that don’t change, and will also instruct the Cloudflare CDN to cache files longer.

On a side note, the rules you have specified are often set by default on servers (without having to use .htaccess). If they are, then you could remove the rules from .htacess.

This topic was automatically closed after 30 days. New replies are no longer allowed.