How to set a custom sub-domain path in DirectAdmin

UPDATE: See below, there's an easier way to do this. Plus DirectAdmin's way doesn't seem to be working through the 'Custom HTTPD Configurations' way.... So, just use the way listed below. It's much easier.

*** OLD WAY / start ***
I work with Drupal's Domain Access module a lot. However, if you're using DirectAdmin as your hosting control panel, then making sub-domains will not work with the default setup. DirectAdmin puts the sub-domain into a separate directory, and in order for Domain Access to work with sub-domains on DirectAdmin, this needs to be set as the same directory/path as the top domain.

A simple work around is to login to DirectAdmin as administrator, and go into "Custom HTTPD Configurations".

Here you will paste the following code:

|*if SUB|
|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html|
|*endif|

That's it. Now you'll be able to use sub-domains with Domain Access under DirectAdmin.

One last note. Say you set this as the default settings as instructed on http://help.directadmin.com/item.php?id=199 . And you want to go back to using a sub-directory for a specific domain. You would use the following code:

|*if SUB|
|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html/`SUB`|
|*endif|

*** OLD WAY / end ***

A simpler way to create sub-domain in the parent directory /public_html/ in DirectAdmin

Ok... So come to find out there's an easier way to create a subdomain for Drupal's Domain Access module. Basically, you do NOT use the "sub domain management" section. Instead use the "Domain Pointer" section, and fill in the entire sub-domain name in the field.

Example: sub.domain.com or in context with this domain help.duntuk.com. (FYI, that domain is fictitious)

ok... cool.

Tags: DirectAdmin Linux Drupal Domain Access