Redirect all unused subdomains


So I want things like: -> -> -> -> ->

I’ve added this DNS record:

This is all working and requests get to the server for all subdomains.

The next step is how to make the server handle these redirects? What’s the best way? Is this any use?:

In the mean time, the ‘bad_httpd_conf’ error message is displayed for unused subdomains, which I much prefer to undefined behaviour based on the NXDOMAIN handling of the visitor’s ISP / DNS resolution service.

Really, I think this should either be default for unused subdomains, or there should be an easy web panel setup for it.



We can’t use wildcard domains unless we ask Support to enable them :wink:

You can select which directory a [sub]domain is served from in Manage Domains.

Unless you have lots of redirections it might be better to just use that.


I’ve just realised that the server is aware of the whole URL. The browser sends the path to the server in a http GET request, but the hostname is also sent in a ‘Host:’ header of the same request.

I know, I did trying using ‘*’, but it wouldn’t let me. I might ask support to do so, but it’s not quite what I want anyway.

So this would allow for: -> (or -> (or
* -> (or -> (or -> (or
* -> (or

Note that the first 3 are just special cases of the last 3.

For unused subdomains, the path and subdomains would simply be dropped and redirect to the homepage of the primary domain. This should really be default. It just seems so much more professional to have the unused subdomains of a site not be NXDOMAIN.

However, this is not consistent with serving 404 pages for unused URLs.

Ideally, I want to serve 404 pages that are aware of the full URL, not just the path. Then I can offer automatic suggestions or have more programmatic control over how redirects work.

How do I do this?

Yes, I’ve done so for some used subdomains.