Gojko

Well-Known Member
Nov 24, 2014
101
7
18
Macedonia
cPanel Access Level
Root Administrator
Hello i'm thinking about optimize by default with config file of apache.

something like Enable gzip compression | GTmetrix

(and other like headers etc.) put in apache config file so clients don't need to put it in theirs .htaccess file

so my question is: is this possible?
what if i put that code, and someone don't want to have it. Can he disable this via .htaccess and how (with gzip example)?

and one more if i put example gzip compression and someone also put the same thing in his .htaccess what would happen?
 

Gojko

Well-Known Member
Nov 24, 2014
101
7
18
Macedonia
cPanel Access Level
Root Administrator
I know that, but I am worried about other things that I have already mentioned.

Like this if i put in conf file of apache
Code:
<IfModule mod_expires.c>
  FileETag MTime Size
  AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
  ExpiresActive On
  ExpiresByType text/html "access 600 seconds"
  ExpiresByType application/xhtml+xml "access 600 seconds"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/javascript "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/javascript "access 1 month"
  ExpiresByType application/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresByType image/jpg "access 1 year" 
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
what if someone want to turn this off or want to change "access 1 month" to "access 1 year"?
 
Last edited:

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @Gojko,

You may want to consider simply enabling the Optimize Website feature at account creation time and then automatically appending your custom configuration rules to the /home/$username/.htaccess file at account creation time via a post account creation hook. The following resources are useful as proof-of-concepts if you want more information about how hooks work and how to automate tasks:

Tutorial - How to Setup Standardized Hooks with BASH in cPanel & WHM
Tutorial - How To Automatically Install WordPress On New Accounts

Your users could then disable the Optimize Website feature or manually modify their .htaccess files in order to customize the rules.

Thank you.