Why does my site only work with a www in the URL?

17,465

Solution 1

Basically www is just a subdomain. The reason the specific site doesn't work without the www subdomain can either be a misconfigured DNS or a misconfigured configuration.

You can try to do a nslookup to find out to which IP's they are assigned (to check the DNS settings are correct):

Example of my own domain:

nslookup responsible-disclosure.com
Server:  router.home
Address:  192.168.1.254

Niet-bindend antwoord: (non-authoritive answer in english I think)
Naam:    responsible-disclosure.com
Address:  46.105.30.3

nslookup www.responsible-disclosure.com
Server:  router.home
Address:  192.168.1.254

Niet-bindend antwoord: (non-authoritive answer in english I think)
Naam:    www.responsible-disclosure.com
Address:  46.105.30.3

If those two match you're Apache (vhost) might be misconfigured. If you don't see the misconfiguration you need to add you config nito the question so we can take a look.

As to why people prefix the URL with www check out Wikipedia:

Many domain names used for the World Wide Web begin with www because of the long-standing practice of naming Internet hosts (servers) according to the services they provide. The hostname for a web server is often www, in the same way that it may be ftp for an FTP server, and news or nntp for a USENET news server. These host names appear as Domain Name System (DNS) subdomain names, as in www.example.com. The use of 'www' as a subdomain name is not required by any technical or policy standard; indeed, the first ever web server was called nxoc01.cern.ch,[26] and many web sites exist without it. Many established websites still use 'www', or they invent other subdomain names such as 'www2', 'secure', etc. Many such web servers are set up such that both the domain root (e.g., example.com) and the www subdomain (e.g., www.example.com) refer to the same site; others require one form or the other, or they may map to different web sites.

Solution 2

  1. URL for site have not any relation to using or not using any web-technologies on site. It's a question of DNS-settings of domain and configuration of web-server, which serve site

  2. Read zone definitions for sites domains from these vps and find difference. In Bind jargon adding to domain

    @ IN CNAME www

    www IN A NN.NN.NN.NN

leads to "cloning" of host www address to the address of domain. And if in web-server config for www-site domain-name aliased in any form to www, both URLs will show same content.

DNS and Web config changes must be done by hand

Share:
17,465

Related videos on Youtube

Mikhail
Author by

Mikhail

Label-free imaging and inverse optics applied to high-content screening and assisted reproductive technologies. Experience developing new imaging platforms and software tools for biomedical applications, with a focus on interferometric contrast enhancement and high-throughput instrumentation. You can find me in the Lounge<C++> chat room. I keep most of my stuff on gitlab. 6月4日天安门广场大屠杀 美国的没有GFW,美国的surveillance跟国内根本不是一个级别的。在SO上你可以批评美国政府批评美国总统,没有人会删帖,也没有人来查你水表。

Updated on September 18, 2022

Comments

  • Mikhail
    Mikhail over 1 year

    I'm a bit confused as the following points:

    1. There is a simple text website, with no javascript, that works only with the prefix. http://www.mysite.corporation.com works but http//mysite.corporation.com will not work. What could be going on?
    2. I run a few LAMP vps' and don't recall ever having trouble with the leading www
    3. Why do people write URLs with a www. Is there some history behind this?
  • Lazy Badger
    Lazy Badger over 12 years
    Piece of deliriums, because 1.www is not subdomain, but host in domain 2. Nobody state in RFCs, what domain must have A RR and it must be equal to www RR, thus - "misconfigurations" are just FUD
  • PeeHaa
    PeeHaa over 12 years
    @LazyBadger I don't know what you mean with "Piece of deliriums" but hey whatever. 1, Technical you are correct when you say that www is a host. 2. It is a misconfiguration if you intent it to point to mysite.corporation.com and it doesn't. It's not misconfigured because the RFC states it's ok. It's a misconfiguration because it doesn't work like OP wants it to work...
  • Lazy Badger
    Lazy Badger over 12 years
    it's not misconfiguration, if somebody wants, but do nothing. It's illiteracy and brain laziness