0

I have several domains running under apache. Most of theme they do not have yet virtualhost. My problem is that all this not registered domains by apache are getting redireted to the setup domain. How to force apache to accept request just from the domain.

what I mean

<VirtualHost *:80>
        ServerAdmin info@mydomain.com
        ServerName mydomain.com
        ServerAlias mydomain.com www.mydomain.com
        DocumentRoot /var/www/mydomain.com/
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/mydomain.com/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

than I have for example domain1.co.uk, domain2.org all are redirected to mydomain.com. This should be avoided

if I use wildcar like ServerAlias *.domain1.co.uk and I have subdomain svn.domain1.co.uk than the svn subdomain is going to be redirected to domain1.co.uk

2

Add a default virtualhost, like this:

<VirtualHost _default_:80>
    ServerName example.com
    ServerAlias *.example.com
    DocumentRoot /var/www/htdocs
</VirtualHost>
0

You just have to add your domain names in the ServerAlias directive's list an configure each DNS zone to resolve as your Web server.

  • and what about if I have for example for mydomain.org a subdomain (test.mydomain.org) in this case the wildcard (.*) won't work – fefe Apr 24 '13 at 20:11
  • In ServerAlias, you can specify *.mydomain.org if this is what you mean. – Spack Apr 24 '13 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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