Results 1 to 6 of 6

Thread: Activating Certain Features On Installation

  1. #1
    Member
    Join Date
    Jun 2008
    Posts
    234

    Default Activating Certain Features On Installation

    Hi,

    It is possible to configure certain cPanel features to be activated on account creation? For example, I'd like for compression ("Website Optimization") to be on by default.

    Thanks,

    Mark

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Activating Certain Features On Installation

    Hello Mark,

    If you place the following content into /root/cpanel3-skel location with a file you name .htaccess, then you will have Optimize Website enabled for "Compress all content" radio button:

    Code:
    <IfModule mod_deflate.c>
        SetOutputFilter DEFLATE
        <IfModule mod_setenvif.c>
            # Netscape 4.x has some problems...
            BrowserMatch ^Mozilla/4 gzip-only-text/html
            
            # Netscape 4.06-4.08 have some more problems
            BrowserMatch ^Mozilla/4\.0[678] no-gzip
            
            # MSIE masquerades as Netscape, but it is fine
            # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
            
            # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
            # the above regex won't work. You can use the following
            # workaround to get the desired effect:
            BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
            
            # Don't compress images
            SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
        </IfModule>
        
        <IfModule mod_headers.c>
            # Make sure proxies don't deliver the wrong content
            Header append Vary User-Agent env=!dont-vary
        </IfModule>
    </IfModule>
    For this code, place it into an .htaccess file (again, at /root/cpanel3-skel/ location) and then try creating a new account. You will see that /home/username/.htaccess has the above content and then when you visit cPanel > Optimize Website for that new account, you will see the radio button for "Compress all content" already selected.

    Thanks!
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Member
    Join Date
    Jun 2008
    Posts
    234

    Default Re: Activating Certain Features On Installation

    Thank you so much! That's easy!

    Followup question (somewhat related):

    We'd also like to activate browser caching by default on our WordPress hosting plans (a cPanel account with WordPress preinstalled). So, in addition to the code you mentioned for compression, can we just add that code to our created .htaccess file in the skeleton?

    For example:

    ## EXPIRES CACHING ##
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 2 days"
    </IfModule>
    ## EXPIRES CACHING ##

    Thanks,

    Mark

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Activating Certain Features On Installation

    You can add whatever entries you would like into the .htaccess in /root/cpanel3-skel location. Anything placed there will be copied into the new account during creation.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    Member
    Join Date
    Jun 2008
    Posts
    234

    Default Re: Activating Certain Features On Installation

    Followup: What if users install new web sites within their accounts (e.g., installing WordPress with Installatron in a subdirectory)...will those new sites have any of these features too? For example, is the "Optimize Website" function inherited?

    Thanks and best regards,

    Mark

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Activating Certain Features On Installation

    This code is only added during main account creation. If you want anything added during any subdomain or addon creation, you'll need to create a hook script to tie into that creation process. I'd suggest posting that question into the developers section of the forum.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. Problem with activating cPanel License
    By mmnaseri in forum New User Questions
    Replies: 1
    Last Post: 12-22-2011, 02:32 AM
  2. Activating Domainkeys at Enom
    By ebizindia in forum New User Questions
    Replies: 3
    Last Post: 01-27-2010, 10:23 PM
  3. activating shared ip addresses
    By betoranaldi in forum New User Questions
    Replies: 1
    Last Post: 01-08-2008, 09:57 AM
  4. Activating uploaded files and site
    By magda in forum New User Questions
    Replies: 1
    Last Post: 12-20-2005, 02:55 PM
  5. Activating cpanel
    By robmacneil in forum New User Questions
    Replies: 2
    Last Post: 03-25-2005, 07:13 PM