Page 1 of 1

Instructions for adding a subdomain?

Posted: Thu Feb 02, 2023 8:29 am
by till
How exactly do I add a subdomain?

I tried the obvious thing; went to:
Web Sites / Domain Names > Edit DNS > Modify Host Records

"Add a new record",
with "subdomain.domain.com", "CNAME", "domain.com/directory"

And it doesn't seem to have an effect.

I'm guessing there is another step or something?

-- Don Tillman

Re: Instructions for adding a subdomain?

Posted: Thu Feb 02, 2023 4:56 pm
by virtualmike
Easiest way I've discovered is to reach out to Support. Depending what you want to do with the subdomain, Sonic may need to do some work in its system beyond the DNS changes.

Re: Instructions for adding a subdomain?

Posted: Fri Feb 03, 2023 7:01 pm
by joemuller
till wrote:How exactly do I add a subdomain?

I tried the obvious thing; went to:
Web Sites / Domain Names > Edit DNS > Modify Host Records

"Add a new record",
with "subdomain.domain.com", "CNAME", "domain.com/directory"

And it doesn't seem to have an effect.

I'm guessing there is another step or something?
Unfortunately, that trick won't work, as CNAME records can only point at other DNS names, and in standard URL, that only exists between the protocol part (http://) and any path (/foo.html or the implied /). What you may be able to do, assuming you want something like a visitor to http://foo.example.com to get directed to http://example.com/foo/ then you would set up a CNAME like this:

foo CNAME example.com. (the trailing dot is needed to signify this is the full name of the destination)

You could then do some trickery with an .htaccess file in your hosting directory for example.com with the following lines: (you can omit the first line if it already exists in the file)

Code: Select all

RewriteEngine on
RewriteCond %{HTTP_HOST} ^foo.example.com$
RewriteRule ^(.*)$ http://example.com/foo/$1 [R=301,L]
It's not perfect, as the visitor will see http://example.com/foo/ in their URL bar, but this is handy if, for instance, you had a separate blog in /blog/ and had all the URLs or a Wordpress install inside set up so they're at http://example.com/blog/.

Hope this is helpful for you! :)

-- Joe M
System Operations
Sonic.