Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: DNS CNAME Records for Subdomains  (Read 5477 times)

0 Members and 1 Guest are viewing this topic.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
DNS CNAME Records for Subdomains
« on: August 10, 2010, 12:25:34 AM »
Hello all,

I have a question about how to properly set up cname records for a subdomain that points to my domain (eg: music.zylblog.info, which is the exact case I am asking about!)
Here is the predicament:
The record looks like this:

CNAME
   music    is an alias of    zylblog.info    with automatic TTL

and I can access http://music.zylblog.info
BUT, I can not access http://www.music.zylblog.info

My question is this: How can I make it so that www.music.zylblog.info works? (And any other subdomains I choose to add..)
Also: Is there another way to do this through Apache? (Since I have few "sub-blogs", DNS configuration works fine for now).

Thank you for your attention in this matter,
Jesse Zylstra

P.S. music.zylblog.info is a real site, but I am not near finished developing it yet -- don't expect much if you are trying to figure out what I have been up to.

kpac

  • Web moderator
  • Moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: DNS CNAME Records for Subdomains
« Reply #1 on: August 10, 2010, 07:32:42 AM »
You see, "www" is actually a virtual sub-domain of zylblog.info which servers treat as the default.

Add this to .htaccess file in root folder of music subdomain, assuming your host supports it:
Code: [Select]
RewriteCond %{HTTP_HOST}      ^music.zylblog.info                 [NC]
RewriteRule ^(.*)$            http://www.music.zylblog.info/$1    [R=301,L]

I'm not sure if that works for subdomains, but try it anyway.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: DNS CNAME Records for Subdomains
« Reply #2 on: August 10, 2010, 01:25:55 PM »
Nope, unfortunately it did not.

kpac

  • Web moderator
  • Moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: DNS CNAME Records for Subdomains
« Reply #3 on: August 10, 2010, 04:21:10 PM »
Try this:
Code: [Select]
RewriteEngine On
RewriteRule ^http\:\/\/music\.zylblog\.info\/(.*)$      http://www.music.zylblog.info/$1    [R=301,L]

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: DNS CNAME Records for Subdomains
« Reply #4 on: August 10, 2010, 06:21:31 PM »
That also did not work.
It seems to me that we should be changing something in Apache itself, but I have no idea what.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: DNS CNAME Records for Subdomains
« Reply #5 on: August 16, 2010, 10:35:27 PM »
End of the line, eh?

kpac

  • Web moderator
  • Moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: DNS CNAME Records for Subdomains
« Reply #6 on: August 17, 2010, 03:28:01 AM »
It looks that way. ;D

 Sorry I haven't got a solution. You could try over at webmaster-talk.com.