gzip page htaccess compression rewriterule parameters





gzip page htaccess compression


Htaccess redirect

Learn gzip page htaccess compression rewriterule flags , syntax using the sample example below.

Turning On gzip page Compression (aka Reducing Your File Size!)


Did you know that you could potentially reduce the file size of your served content by over 70%? I am not kidding. If your server has the appropriate compression modules installed (mod_deflate or mod_gzip), you can decrease the file size of your pages by over 70% by just adding a single line to your .htaccess file:
SetOutputFilter DEFLATE
Once you've added this line, your server will compress all content that it sends to your browser.

Compress output using GZIP

Add following snippet into your htaccess file and compress all the css, js, html files with GZip compression.


<IfModule mod_gzip.c>
    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.*
</IfModule>

Above code works only if mod_gzip module is enabled in your webserver. You may want to add following snippet if your webserver provides mod_deflate support.


<Location>
    SetOutputFilter DEFLATE
      SetEnvIfNoCase Request_URI  \
        \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI  \
        \.(?:exe|t?gz|zip|gz2|sit|rar)$ no-gzip dont-vary
</Location>

If your webserver does not support mod_deflate then you may want to use following snippet.


<FilesMatch "\.(txt|html|htm|php)">
    php_value output_handler ob_gzhandler
</FilesMatch>

 


gzip page htaccess compression syntax

gzip page htaccess compression code on this is provided for your study purpose, it will guide you to know how to use mod_rewite to create .htaccess files on the apache servers. use it to practice and train your self online

All the tutorials on this site are free, the page code is provifed for you to use it to practice, if you want to help to improve and maintain this work, you can donate to us on.



Htacess tutorial guides withexamples and easy steps to set ip up on your server.


Htaccess Generator

Htaccess block all bad robots

prevent hack

redirect www to non www

modifying the environment variable

file access deny control

cache control no cache and cache public

ip blocking

adding new mime types and set timezone

hot to create file

hide .

gzip page compression

force file save

password protect a directory

hotlink protection

custom error page

stop directory listing

block and allow referrer

set cookie domain authentication

prevent directory listing

php 301 redirect

upload_max_filesize limit

301 redirect

changing home directory page

All the tutorials on this site are provided for free. You can copy and print the tutorials and code on this site, but you are not allowed to reproduce this information on another website. All rights reserverd 2012

Copywright © 2013 www.htaccessredirect301.com Site created By prince Ejike Google+

promo