The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Custom configuration for website in httpd.conf

Discussion in 'General Discussion' started by nisamudeen97, Mar 10, 2016.

  1. nisamudeen97

    nisamudeen97 Active Member

    Joined:
    Jul 7, 2010
    Messages:
    38
    Likes Received:
    4
    Trophy Points:
    8
    Location:
    Cochin
    cPanel Access Level:
    Root Administrator
    Hi,

    I have some custom redirection rules for my website. These redirection rules are not working via .htaccess as expected as some of my files are loading from outside public_html. I have tried the same redirection rules directly in httpd.conf vhost section of the particular website. Then all the rules are found working fine as expected.

    Meanwhile these custom redirection rules are found getting vanished after every apache rebuild and server restart. Is it possible to make my custom redirection rules permanent in httpd.conf ?
    Let me know how can I do that ?
     
  2. max_payne

    max_payne Active Member

    Joined:
    Feb 1, 2013
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Copy and paste the entire vhost entry in the following file:

    /usr/local/apache/conf/includes/pre_virtualhost_global.conf

    or here in WHM:

    WHM>>Apache Configuration>>Include editor>>Pre Virtualhost Include>>All versions

    Restart apache if you add it directly to /usr/local/apache/conf/includes/pre_virtualhost_global.conf from CLI. A customized virtual host entry specified here is not overwritten. Any direct modifications to the httpd.conf file on cPanel servers is not recommended. It clearly states this on top of the httpd.conf file.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    649
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page