5
votes

Some people say that to enable compression you modify htaccess file:

Others say you need to update httpd.conf file

What is the right way? If either is correct then wouldn't htaccess be a better choice since it doesn't require web server restart?

2

2 Answers

1
votes

The Apache HTTP Server can be configured in a number of ways: The main configuration file is (usually) called "httpd.conf", but this file can include other configuration files with the "Include" directive. Furthermore, the HTTP Server allows for configuration files to be placed in the context path of your website. These decentral configuration files are (usually) called ".htaccess".

Configuration directives, like the directives to enable compression, can be valid in different contexts. The valid configuration contexts of the "AddOutputFilter", the "SetOutputFilter", and the (deprecated) "AddOutputFilterByType" all specify "server config, virtual host, directory, .htaccess" as their valid configuration contexts. Therefore, all of these directives can be used in the "httpd.conf" as well as in the ".htaccess" configuration files.

So both ways of configuring output compression are valid, and it's just a matter of taste whether you want all your server configuration in one central file (which gets only read during server (re)start) or whether want to spread the configuration in multiple files and directories (but get the benefit of changes being applied instantly).

0
votes

If your Web Host is through C Panel Enable G ZIP Compression on Apache C Panel

  1. Go to CPanel and check for software tab.

  2. Previously Optimize website used to work but now a new option is available i.e "MultiPHP INI Editor".

  3. Select the domain name you want to compress.

  4. Scroll down to bottom until you find zip output compression and enable it.

  5. Now check again for the G ZIP Compression.

You can follow the video tutorial also. https://www.youtube.com/watch?v=o0UDmcpGlZI