My site works both with and without the www subdomain (i.e., both example.com
and www.example.com
work). However, anything.example.com
also works and the same website content is served.
How can I disable all subdomains except www.example.com
? I want all other subdomains to return a 404 error or just not show anything.
The config now is as follows:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
...
</VirtualHost>