Adding custom httpd.conf code to the VirtualHosts of a domain

DirectAdmin Allows Admin to insert extra httpd.conf code that a User may require.  To access the control page for this functionality, go to Admin Panel -> Admin Settings -> Customize Httpd Configurations.

Once you see the list of domain, click the domain you wish to insert the extra httpd.conf code to.

At the bottom of the page, you’ll see the current httpd.conf for that User.  It will contain all VirtualHosts for all domain, subdomains and redirects.  Any changes made by this page will only affect the VirtualHosts for the domain in question, not the other domains owned by that user.  If all domains need the changes, then you would repeat this process for each domain.

The top textarea is where you will paste the custom httpd.conf code you wish to insert.   The code you write will be inserted into the |CUSTOM| token for all VirtualHosts for this domain.  You can edit the templates as needed if you require to move the |CUSTOM| token to a different position in the VirtualHost.

All tokens that are available for the VirtualHost will be available with this feature.  You can also set any token you wish.  For example, if you with to change the DocumentRoot for a domain, you can paste:


Note that this new DocumentRoot will be used for all DocumentRoots for this domain, including https connections and subdomains, so it may not be a desired effect.

Another common use is to add another ServerAlias.  This allows another domain to be used to access the exact same content.  To accomplish this, you would write


To get and to point to the original domain for the VirtualHost.  You will also have to make sure that and both resolve to the same IP as stored in |IP|.

Note, the above example will set the DOCROOT token into all 4 templates, so this will also apply to all subdomains, which may not be desired.
To only make the DOCROOT apply to the domain, and not to the subdomain, add an if, eg:

|*if !SUB|

By anup