Operating System & Version
CloudLinux v7.9.0
cPanel & WHM Version


Dec 22, 2019
cPanel Access Level
Root Administrator
I want the subdomain foo.exmple.com point to (via ProxyPass or ProxyPassReverse) for all of the users of cPanel server.

I want to apply this modification on default virtual host template effect all users accounts. (Looks like cpanel.example.com which is pointing to example.com:2082)

I can do this via .htaccess file:

RewriteEngine On
RewriteRule ^(.*)$$1 [P,L]

But it only works per account while there are +1000 domains on my server and I can't repeat that manually. (Also the user can delete or modify .htaccess file)
How can I perform that for all accounts/domains?

I know I should perform changes in Include Editor section of Apache Configuration, But I don't know which part of that and what statement to write.

I use Litespeed 6.0.1 on cPanel (CloudLinux)


Well-Known Member
Nov 6, 2019
Kerala, india
cPanel Access Level
Root Administrator
HI Gamecock

generally,if common unique rules needs to be affected to all virtual host you can add the rules to any of the following files

but according to your requirement, each domain should have separate proxy pass where example.com will vary so above method will not work .
so in order to achieve that ,

you can edit the following apache template files

and add the following code at the end but just before the virtual host closing tag </virtualhost>

   RewriteCond %{HTTP_HOST} !^foo.[% vhost.servername %]$
   RewriteCond %{HTTP_HOST} ^foo\.
   RewriteCond %{HTTP:Upgrade} !websocket   [nocase]  
   ProxyPass "/" "" 
   ProxyPassReverse "/"
this is just a sample and you can change the code accordingly based on the requirement

after that rebuild the apache conf and restart apache , then all virtual host will be added with above apache settings automatically

to revert any chnages simply delete the added code and rebuild the apache again..
  • Like
Reactions: cPRex