19

I have purchased My Domain name from one registrar & hosted in another hosting company. I have created a sub domain from my hosting domain manager lie http://subdomain.domain.com and it works fine. But when someone types in www.subdomain.domain.com the site is not working.

Do I need to make changes in my DNS Manager of hosting CPanel or DNS Manager of my Domain CPanel?

Also What all Records I need to add ( like A Record or CNAME) to redirect www.subdomain.domain.com to subdomain.domain.com.

I don't want to see www for my subdomain, but only wants to get redirected to subdomain.domain.com.

Kara
  • 6,115
  • 16
  • 50
  • 57
SEOFuGenX
  • 191
  • 1
  • 1
  • 4

6 Answers6

13

It doesn't work because www.subdomain.domain.com doesn't exist. You have to add a CNAME record in your zone subdomain.domain.com the same way you've added the host subdomain to domain.com.

tomferon
  • 4,993
  • 1
  • 23
  • 44
  • when some people type www.subdomain.domain.com it should go to subdomain.domain.com . How to achieve this redirection? – SEOFuGenX Nov 28 '11 at 13:02
  • The first thing to do is to add a CNAME record to `subdomain.domain.com` for the host `www` in the zone `subdomain.domain.com`. Secondly, you can add a redirection in your webserver configuration for every request on the host `www`. (for Apache, http://www.thesitewizard.com/apache/redirect-domain-www-subdomain.shtml it seems to answer the question) – tomferon Nov 28 '11 at 13:06
  • 1
    It looks right. You can just check it by resolving `www.fish-warrior.***.com` in a console with a tool such as `dig`. You now need to configure your webserver. – tomferon Nov 28 '11 at 13:17
  • Do I need to add a A Record like www.fish-warrior.*****.com which points to the IP? And how to configure the web server? – SEOFuGenX Nov 28 '11 at 13:21
  • 1
    No, a CNAME record is a better id while `www.fish-warrior.***.com` will always point to the same IP as `fish-warrior.***.com`. The webserver configuration depends on what you use. I gave you a link for Apache above, for others like nginx, finding tutorial for redirection is easy. – tomferon Nov 28 '11 at 13:30
  • RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.fish-warrior.fugenx\.com$ [NC] RewriteRule ^.*$ http://fish-warrior.fugenx.com%{REQUEST_URI} [R=301,L] - My htaccess. Also is there anything I Need to do in my hosting Account – SEOFuGenX Nov 28 '11 at 13:34
10

You need to register that subdomin too.

Yes - www.subdomain.domain.com is a subdomin of subdomain.domain.com. There is nothing special about the www prefix, as far as the domain system or browsers are concerned.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
1

This helped me out. I hope it helps anyone going through the same thing.

Yes, as you said CNAME record www for customer1.mysite.com will report an error. To make it working, you should be able to add CNAME record www.customer1 for mysite.com instead of www for customer1.mysite.com - xMudrii https://www.digitalocean.com/community/questions/how-to-configure-subdomains-to-use-www-and-non-www

francis
  • 11
  • 1
0

Create CNAME as sub.domain.

Point to @ where sub.domain is your subdomain name and maindomain name.

rocambille
  • 15,398
  • 12
  • 50
  • 68
0

If you want to add "www" in the subdomain then create the same configuration subdomain and add "www" in that domain.

you required to add both domains name www.subdomain.domain.com and subdomain.domain.com enter image description here

Sher Singh
  • 497
  • 5
  • 8
-1

Say you have a website www.example.com and you want to have a working link like www.service.example.com, then you need to enter the subdomain name www.service (and not service) while setting up the sub-domain.

Preferably set up both sub-domains i.e. www.service and service for users who type in www.service.example.com and service.example.com on their browsers.

goldcode
  • 633
  • 8
  • 21