user1386320
user1386320

Reputation:

Apache's VirtualHosts wildcard in ServerName attribute

Is it possible to create a "wildcard" on ServerName attribute on a VirtualHost statement?

I currently have something like this:

<VirtualHost *:80>
    ServerName testhost
    DocumentRoot "C:/xampp/htdocs/testhost/"
</VirtualHost>

What I would like to is something like this:

<VirtualHost *:80>
    ServerName $serverRequest
    DocumentRoot "C:/xampp/htdocs/" + $serverRequest
</VirtualHost>

So I could redirect all similar hosts to a same-name directory. Is it possible?

Upvotes: 2

Views: 2666

Answers (1)

James C
James C

Reputation: 14149

I think that you're after Dynamically Configured Mass Virtual Hosting.

Upvotes: 2

Related Questions