I'm trying to set up multiple domains on my Amazon EC2 micro instance running Ubuntu Server 12.04. I installed Apache correctly and set up virtual hosts but having problems with wildcard subdomains.
This is what my httpd.conf file looks like
NameVirtualHost *:80 <VirtualHost *:80> UseCanonicalName Off VirtualDocumentRoot /home/username/domains/%0/html/ </VirtualHost>
My DNS records (on Amazon Route 53) are:
domain.tld A 126.96.36.199 *.domain.tld A 188.8.131.52
If i create a
test.domain.tld directory with the
html subdirectory, it works fine. But what I want to do is to redirect
domain.tld in case there is no directory for the sub-domain accessed. I would also like
www.domain.tld to redirect to
domain.tld. The system should also work if I decide to host another website,
example.com, on the server.
I tried Googling a lot but without any luck. Suggestions?