2

I have an Apache server with multiple webprojects. Every project has a development, and a production site associated like this:

/srv/www/project1/dev /srv/www/project1/prod /srv/www/project2/dev /srv/www/project2/prod /srv/www/project3/dev /srv/www/project3/prod 

Every project also has a virtual-host file - this is for project 1:

# Prod <VirtualHost 123.45.789.123:80> ServerAdmin [email protected] ServerName www.johndoe.com DocumentRoot /srv/www/project1/dev </VirtualHost> # Dev <VirtualHost 123.45.789.123:80> ServerAdmin [email protected] ServerName dev.johndoe.com DocumentRoot /srv/www/project1/dev # enable php error_reporting for development site <Directory /srv/www/project1/dev> <IfModule mod_php5.c> php_value error_reporting 214748364 php_flag display_errors 1 </IfModule> </Directory> </VirtualHost> 

Everything is working fine like this. However, I find it redundant to add the IfModule mod_php5.c part to all virtual hosts. Is it possible to add it to the default virtual host file like this (I've tried, and can't make it work):

 <DirectoryMatch "^/srv/www/.+/dev"> <IfModule mod_php5.c> php_value error_reporting 214748364 php_flag display_errors 1 </IfModule> </DirectoryMatch> 

Looking forward to hear your input!

1 Answer 1

1

Add your <DirectoryMatch> block directly to the server config, don't put it inside a <VirtualHost> block. Check here for more information about the scope of this directive: http://httpd.apache.org/docs/2.2/mod/core.html#directorymatch

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.