EA4: Apply to all virtual hosts on the system not working

rahnev

Well-Known Member
Jul 6, 2016
62
7
58
Bulgaria
cPanel Access Level
Root Administrator
I want to apply some configuration, which to be common for all vhosts and want to include it to all of them. According EA4 documentation I have to use /etc/apache2/conf.d/userdata/$includename.conf file.

For example I'm trying with a simple redirect rule:
Code:
cat /etc/apache2/conf.d/userdata/redirect.conf

RewriteEngine on
RewriteRule ^test$    http://test.com [L,R=302]
However in http.conf configs in userdata dir are not included and configuration is not loaded. Here are all includes in http.conf
Code:
grep -i include /etc/apache2/conf/httpd.conf | grep -v "#"

Include "/etc/apache2/conf.modules.d/*.conf"
Include "/etc/apache2/conf.d/includes/pre_main_global.conf"
Include "/etc/apache2/conf.d/*.conf"
Include "/etc/apache2/conf.d/includes/account_suspensions.conf"
Include "/etc/apache2/conf.d/includes/errordocument.conf"
Include "/etc/apache2/conf.d/includes/pre_virtualhost_global.conf"
Include "/etc/apache2/conf.d/includes/post_virtualhost_global.conf"
Am I doing something wrong?

Edit: It's missed in the documentation that you need to run
Code:
/scripts/ensure_vhost_includes --all-users
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Hello,

I'm happy to see you were able to address the issue. Could you let us know which document you were viewing so we can review it and open an improvement case if needed?

Thank you.