![]() ![]() Now copy following lines in your htaccess file. Copy the PHP code that we saw in above example in a file called gzip-enable.php. First we will see how we can prepend a PHP file and achieve this. GZip using php_value directive in htaccess php_value directive can be used to append/prepend any PHP files in the request of change the output handler. There are still ways to achieve this without touching your PHP files. Only problem with this method is that you have to manually edit all PHP files or should have a header.php file that gets included in all files. Thus output is compressed using ob_gzhandler. If (substr_count($_SERVER, 'gzip'))Ĭode language: PHP ( php )Above code will check whether your browser supports gzip, if yes, then it send ob_gzhandler method as handle to ob_start method which buffers the output. You can enable compression for text and html by adding following lines in your htaccess file. First you have to check whether your hosting provider has enabled mod_gzip or mod_deflate module or not? To check this, you can use php_info() function of PHP which prints all the information about server and modules. You can use this module and enable GZip compression for your website using htaccess file. GZip using mod_gzip, mod_deflate and htaccess Apache server supports server level GZip compression with the help of module mod_gzip and mod_deflate. GZip compression in Tomcat, JBoss server You can find a full post explaining this trick here. I have listed out following very useful tricks to enable compression. Compressing output can significantly improve your websites performance by reducing the size sometimes upto 80%! So how can you enable GZip compression and compress your websites output? Well there are several ways to achieve this. Hence it is very much advisable to compress your websites response with GZip and then serve it to client. With limited monthly bandwidth hosting, your site may run out of bandwidth and thus result in increase in down time. ![]() Bandwidth control is an important task to be followed when your traffic is increasing. Hence this greatly improve the performance as it reduce PHP parsing and database connections. These HTMLs are served to client whenever consecutive requests are made. This plugin will create static HTML files from your blogs post and other pages and save them on web server. We are using WordPress as CMS for this blog, hence we decided to install WP-Super cache plugin for WordPress to improve the performance. As this site is currently hosted on a shared hosting server, it is very difficult to optimize the performance of the site. Since few days we have been registering heavy traffic spikes on our website. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |