You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by TOOTAi <te...@tootai.net> on 2018/05/11 17:12:01 UTC
[users@httpd] How configuring a per directory and servername access
Hi,
I have a server running lots of virtualhosts, each served by a
servername.
Exemple: demo1.domain.tld demo2.domain.tld ... demoX.domain.tld
I start a migration on an other server/other IP and would like make
tests before production without having to create again all the
servernames in DNS. I would like to have something like this:
Client goes to http://domain.tld/demo[1|2|...|X]
and Apache send the request in the right directory which are
/var/www/demo[1|2|...|X]
What I did:
<VirtualHost *:80>
ServerName cloud.domain.tld
ServerAdmin webmaster@localhost
DocumentRoot /var/www/$1
<Directory /var/www/$1>
DirectoryIndex index.php
AllowOverride All
</Directory>
<Directory /var/www/$1/>
DirectoryIndex index.php
AllowOverride All
</Directory>
</Virtualhost>
When I access with http://cloud.domain.tld/demo3 I get a 404 error The
requested URL /demo3/ was not found on this server.
If DocumenRoot is /var/www (eg w/o $1) I receive error 404 The requested
URL /login2.php was not found on this server which is the file launched
by index.php in the directory served by $1
Using DNS as ServerName like
<VirtualHost *:80>
ServerName demo1.domain.tld
ServerAdmin webmaster@localhost
DocumentRoot /var/www/demo1
<Directory /var/www/demo1>
DirectoryIndex index.php
AllowOverride All
</Directory>
</Virtualhost>
is working.
What am I missing to archieve my goal ?
Thanks for any hint
--
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org