Updating, recompiling, VirtualHost templates, customizations, php safemode …Wildcard *.domain.com

Updating, recompiling, VirtualHost templates, customizations, php safemode …Wildcard *.domain.com, If you’d like to setup your domain to accept anything.domain.com,

you can do the same with the following guide (Admin access required)
Try to See the last method below, then if you want other sub domains to work with their own data, or if you want the main domain to be shown in different data.

1) Now Setup the dns with a wildcard A record.   then Go to Dns Control, and add an “A” record:
*  ->
where is the IP of your domain.

So This will allow anything.domain.com to resolve to your server.  yet Apache does not know how to direct that name though.

2) To setup apache, go to:
Admin Level -> Custom Httpd configurations -> domain.com
In the top text area, add this *one* line:

ServerAlias *.|DOMAIN|

then click “Save”.

That should be it all.  Wait for a few minutes for everything (apache, named) to get restarted then test it out.

The subdomains wildcard will point to your main public_html directory for the domain.

If you want to change this, it is probably best not to do step 2, and to setup your own custom virtualhost manually into the /etc/httpd/conf/httpd.conf (DA wont delete/overwrite it there) with the same ServerAlias directive as is in step 2.

The Other similar uses might be subdomain aliasing, where test.domain.com is the same as test.domain2.com.
by following step 1 You can accomplish this ) above, then insert the following instead of step 2) above:

|*if SUB|
ServerAlias |SUB|.domain2.com

which it will make any existing subdomain from domain2.com point to domain.com.


I still want all other subdomains to pursue to work with their different data

You may notice it when you are using the DomainAlias option on your main domain, that other subdomains also gets handled by the wildcard.
If you want to have a wildcard value, but still are creating subdomains go elsewhere, then you would  need to do the following instead.
The premise is making the wildcard VirtualHost show up dead last in the httpd.conf, after the other subdomain VHs are added.
1) Create the dns records in the same way as step 1) showed above.

2) Create a subdomain normally in DA, like that it’s going to appear dead last in the subdomain list.
It is ASCII alphabetical, so, a value of zzzz may be reliably at the end of the list (unless you have special international characters like ÿ, as they’re got a higher ascii value use those instead ).
We’ll assume you’ went on with zzzz.domain.com as the created subdomain.

This will store your data in that usual place:


so that is where you’re going to store your wildcard data.  All wildcard URLs will go to that DocumentRoot.  (If you want it to point to the main domain’s public_html, either delete the zzzz directory, and replace it with a symbolic link to “..”, or change the DOCROOT to the public_html in the templates (symbolic links are easiest))

3) Now make all wildcards goto the zzzz subdomain, go to:

Admin Level -> Custom Httpd Configuration -> domain.com

paste in this code In the top text-area, :

|*if SUB=”zzzz“|
ServerAlias *.|DOMAIN|

Which, when saved, should add the ServerAlias code to only the zzzz subdomain VirtualHost, which should be at the very bottom of the User httpd.conf file.

Leave a Reply

Your email address will not be published. Required fields are marked *