3

I have looked at setting up an Apache server.

I want to run our site example.com on the server, as well as testing test.example.com.

This I can setup by having two almost identical VirtualHost in the configure file in sites-available.

What I then want is a development subdomain, but these need to be unique per developer, e.g. mol.test.example.com. Is there a smart way to set this up?

I have setup the production to take data from /var/www/live/, the test to take data from /var/www/test/ and would like the development to take data from e.g. /var/www/dev/mol/, where mol is the first part of the URL. (the sub-subdomain for test)

Mads Ohm Larsen
  • 141
  • 1
  • 4

2 Answers2

5

VirtualDocumentRoot should do the trick.

Something like this:

<VirtualHost *:80>
    ServerName testsites.domain.com
    ServerAlias *.test.domain.com
    VirtualDocumentRoot /var/www/dev/%1
</VirtualHost>
Shane Madden
  • 114,520
  • 13
  • 181
  • 251
0
<VirtualHost *:80>
    ServerName domain.com
    ServerAlias *.domain.com
    VirtualDocumentRoot /var/www/html/%1
</VirtualHost>

RewriteRule ^/photo/(.*) /open.php?id=$1 [L,NE,PT]

http://rustyrazorblade.com/2009/01/using-mod_rewrite-with-virtualdocumentroot/

Colt
  • 2,029
  • 6
  • 21
  • 27
Gusss
  • 1