Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

With apache, i want a wildcard so my domains can go to the appropriate folder. www should be ignore/go into root. How do i setup the rules?

         'domain.com' to go to '/var/www/prj/www/root'
'ANYTHING.domain.com' to go to '/var/www/prj/www/ANYTHING'

Currently my file is

<VirtualHost *:80>
    ServerName  domain.com
    ServerAlias *.domain.com
    DocumentRoot /var/www/domain/www
</VirtualHost>
share|improve this question

1 Answer 1

up vote 3 down vote accepted

Try this:

<VirtualHost *:80>
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/prj/www/root
</VirtualHost>

<VirtualHost *:80>
    ServerName wildcard.domain.com
    ServerAlias *.domain.com
    VirtualDocumentRoot /var/www/prj/www/%1
</VirtualHost>
share|improve this answer
    
That did the trick. and no modrewrite to boot! –  acidzombie24 Apr 9 '11 at 1:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.