0

I have the following .htaccess file for my website which is hosted on a Linux, Apache and PHP 5.4.41 stack:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

The following PHP 5.4.41 functionality is available to me on this server as shown here in the PHP info file:

http://88.208.252.229/phpinfo.php

I'm trying to optimise the website so that output from the server is compressed before being sent to the client over the network.

Now I believe this achieved with mod_deflate - The problem is that I don't know how to implement this in the .htaccess file.

In it's most simple form could I not enable compression for HTML files by making my overall .htaccess file look like this? I'm assuming the "/your-server-root/manual" would most likely be htdocs.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

<Directory "/your-server-root/manual">
AddOutputFilterByType DEFLATE text/html
</Directory> 

The final thing to mention that my server would be pre-processing a wide range of files and delivering them to the client such as .jpeg, .html etc. So I would want the mod_deflate to compress as much as reasonably possible.

If anyone can take the time to answer this and increase my understanding of the issue it would be very much appreciated. Thanks in advance.

user1554264
  • 1,204
  • 3
  • 22
  • 47
  • Is this really worth the effort? Most volume critical file types like jpg cannot really be further compressed, they already are. And for the rest, like text formats as html markup and the like, the benefit of saving maybe 30% of the volume... is that really worth it given todays network speed? Keep in mind that not all clients necessarily support compressed content. – arkascha Jun 01 '15 at 10:22
  • Thank you giving me more to put under consideration, what do you suggest then if not using server side compression? Simply minifying files for example? For someone that would like to make minor performance improvements like myself. – user1554264 Jun 01 '15 at 10:24
  • To be even more clear: I doubt such manual compression is justified at all for normal situations. It simply is not worth the effort. _Unless_ you have a very special situation like having to hand over a huge number of plain text documents or similar. – arkascha Jun 01 '15 at 10:30
  • Thanks again I guess the phrase that applies is using a sledgehammer to crack a nut - as in the compression is overkill? At the end of the day the server is delivering a typical brochure website with a few paragraphs of text and a couple of images to an end user, therefore this application of compression would be overkill. I thought it would be useful to learn how to implement if I had to. – user1554264 Jun 01 '15 at 10:43
  • I absolutely agree with that. Your time is valuable! Invest it in things worth the effort! – arkascha Jun 01 '15 at 10:44

0 Answers0