As of the second cPanel & WHM Targeted Security Release of 2018 (TSR-2018-0002), the Optimize .htaccess feature was removed from all supported cPanel & WHM versions. This difficult decision was the result of some security concerns with its implementation. In its place, we have released the mod_cpanel Apache module. This module will begin to improve upon the features that Optimize .htaccess provided.

What is Optimize .htaccess and why is cPanel replacing it?

When we released it, Optimize .htaccess was a function that was intended to boost server performanceIt accomplished that using the AllowOverride directive to reduce the number of paths that Apache checks for .htaccess files. Unfortunately, the functionality was not safe enough for shared hosting customers. There was a possibility of breaking rewrite/redirects, PHP inheritance, among many other things.

We’ve been working to replace the Optimize .htaccess feature with an Apache module (mod_cpanel).

What does mod_cPanel give me as a hosting provider?

mod_cpanel provides a speed boost in two ways. Like Optimize .htaccess, it skips directory paths (/.htaccess, /home/.htaccess, /home/$user/.htaccess, etc) that have already been checked by Apache. New to cPanel is Negative Stat Caching. The mod_cpanel module will perform caching of .htaccess files that do not exist.

Based on our testing, the new style of .htaccess caching enabled by mod_cpanel provides a small performance improvement of about 2-4% faster response times in serving static content.

In mod_cpanel’s current iteration, newly created .htaccess files may not get picked up immediately. The cache is refreshed when any of the Apache child processes are restarted. If Apache has already read from that directory, it may be necessary to perform a graceful restart of the Apache service. Once that has been done, Apache will process this newly added file. Future releases of mod_cpanel will improve that integration, preventing the need to restart Apache.

How do I take advantage of mod_cpanel?

To install mod_cpanel, simply add ‘ea-apache24-mod_cpanel’ to your EasyApache 4 profiles. You can do this by installing the module via the WHM EasyApache 4 interface, or via yum. There are further instructions and explanations included in the mod_cpanel Apache module documentation.

If you have any questions leave a comment below or reach out to us via the cPanel Forum, or open a support ticket with our technical support team!

If you’d rather talk in-person, you can join us at this year’s cPanel Conference, from October 1st – 3rd in Houston, Texas.