Instructions for adding a subdomain?

Web hosting discussion, programming, and shared and dedicated servers.
3 posts Page 1 of 1
by till » Thu Feb 02, 2023 8:29 am
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
by virtualmike » Thu Feb 02, 2023 4:56 pm
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.
by joemuller » Fri Feb 03, 2023 7:01 pm
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.
I'm a proud employee of Sonic.net! :-)
3 posts Page 1 of 1

Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 5 minutes)
Most users ever online was 999 on Mon May 10, 2021 1:02 am

Users browsing this forum: No registered users and 11 guests