Custom configuration for website in httpd.conf

nisamudeen97

Well-Known Member
Jul 7, 2010
55
5
58
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 ?
 

max_payne

Active Member
Feb 1, 2013
33
1
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,216
463