Making website which run faster is everyone dreams and everyone want this to do. Earlier we have posted 2 articles regarding the GZIP Compress for PHP and CSS. You can check them here How to compress PHP using GZIP and How compress CSS using GZIP. Today we are putting using the HTACCESS for doing this and after using it your CSS, PHP, Jquery etc.
You have to copy paste some lines to your .htaccess file and here we go we are done. Here is lines which you have to include in your htaccess file or download the file from below.
<IfModule filter_module> FilterDeclare COMPRESS FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype FilterChain COMPRESS FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no </IfModule> <IfModule !mod_filter.c> # Legacy versions of Apache AddOutputFilterByType DEFLATE text/html text/plain text/css application/json AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE text/xml application/xml text/x-component AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype </IfModule> </IfModule>
You can download the file directly just change the extension. Right now its htaccess.txt you have to change it to .htaccess remember htaccess is extension there is no name for the file.
Thank you reading the Make website run faster using htaccess if you found any difficulties please please comment.
[wpdm_file id=5 title=”true” template=”facebook” ]
Helo Vivek, Will this tutorial also work in localhost environment?
As localhost is already fast so you dont need it over localhost if you want to know the use of it than use it online.