Set up a new domain name

From Organic Design
Jump to: navigation, search
Procedure.svg Set up a new domain name
Organic Design procedure

Transferring a domain

The domain only needs to be moved to a new provider if the current one doesn't provide sufficient control over the DNS to set up the main domain and any sub-domains as A-Records pointing to an IP of the designated server.

If the domain does need to be moved, then we use webdrive.co.nz for local domains and namecheap.com for all others.

Existing sites and settings

Usually an existing site host will be able to leave the current site intact and accessible via one of their own sub-domains. If this is possible please do it because it means less chance of configuration or other information being lost in the migration process. The main site itself can be easily replicated on our server as long as it uses PHP/MySQL technology.

Adding the domain to the server environment

If the site is just a wiki, then the install a new wiki procedure will handle everything. If on the other hand the domain should point to a specific directory of arbitrary HTML or PHP, then a rule will need to be added to the /var/www/vhosts file and the configuration reloaded with /etc/init.d/apache2 force-reload. The rules use regular expressions to determine what the DOCUMENT_ROOT should be for the request.

For example, if we wanted to map the domain foo.co.nz to directory of web site/application files called foo, then the directory is put into /var/www/domains and owned by www-data, and the following rule added to the vhosts file:

This rule should be added just before the first REQUEST_URI rule.

RewriteCond %{HTTP_HOST} foo\.co\.nz
RewriteRule (.*) /foo$1 [L]


The following rule allows foo.co.nz and www.foo.co.nz to use the DOCUMENT_ROOT of /var/www/domains/foo, but all other subdomains will be processed by the friendly url rules so that the request is handled by a wiki.

RewriteCond %{HTTP_HOST} ^(www\.)?foo\.co\.nz
RewriteRule (.*) /foo$1 [L]

Forcing HTTPS for the domain

Here all requests to the domain foo.organicdesign.co.nz are redirected to HTTPS. Note that there must be a corresponding entry in the HTTPS virtual host section to handle requests to that domain.

RewriteCond %{HTTP_HOST} ^foo\.organicdesign\.co\.nz
RewriteRule (.*) https://foo.organicdesign.co.nz$1 [R,L]

Handling email for the domain

Typically the client will need a bunch of email addresses under their domain, and some of these will forward to existing addresses, while the others will have their own POP boxes. Both forwards and POP boxes are set up at the domain host end by logging in to namecheap.com or webdrive.co.nz. If the client needs an IMAP server, that's handled in another procedure which is incomplete currently.

The client needs to provide the following information for email to be set up:

  • Current incoming and outgoing servers
  • Current addresses in use and which are POP's and which are forwards to where

We may have to change the address of the incoming server