Hajo, You can define variables or do any other configuration of Apache just for virtual hosts by creating files for either of these special paths:

* For HTTPS, version 2.4:

/etc/apache2/conf.d/userdata/ssl/2_4/USER/DOMAIN/ANYNAME.conf

* For HTTP, version 2.4:

/etc/apache2/conf.d/userdata/std/2_4/USER/DOMAIN/ANYNAME.conf

For example:

/etc/apache2/conf.d/userdata/ssl/2_4/steve/example.com/vhost.conf

After creating your virtual host common config file, execute the following two commands:

* Rebuild the main config file:
/usr/local/cpanel/scripts/rebuildhttpdconf

* Restart the Apache server:
/usr/local/cpanel/scripts/restartsrv_httpd

I use this technique to configure a common readonly directory outside of any document root that can be accessed by PHP or HTML from any virtual host. Works perfectly on my Centos server as well as my local Windows development server, where my configuration is Included in each virtual host explicitly.

David Spector
Springtime Software

On 11/5/2018 3:43 AM, Hajo Locke wrote:
Hello List,

iam looking for a way to use define to create variables limited to vhosts (apache 2.4).
Currently i have some vhosts and use this syntax:

define myvar mycontent.

Name of variables is in all vhosts the same, "mycontent" is different and vhost related. Later i use this variable in .htaccess files for users:

Addhandler ${myvar} .php

Unfortunately define-directive defines the variable for complete server and not to vhost only. so content of "myvar" gets overwritten with every following vhost-config. So if user A uses this variable, he sees content of variable created in vhost for user z.

Is there a possibility to use variables limited to vhost but can be used the same way in .htaccess files? I think setenv seems not suitable for this.

Thanks,
Hajo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to