Which URL is Right?

Following Andrews’s look at good hyperlink text last week, Steve wrote in to ask about the other side of the hyperlink equation: URLs.

Steve writes,

How about starting a crusade to standardize URLs?

http://www.example.com
http://www.example.com/
http://www.example.com/index
http://www.example.com/index.html
http://example.com
http://example.com/
http://example.com/index
http://example.com/index.html

WHICH ONE IS CORRECT??

Steve

Good question, Steve! First of all, these pairs are equivalent:

  • http://www.example.com

  • http://www.example.com/

  • http://example.com

  • http://example.com/

The trailing ‘/’ is implied if there is no path specified, so you can use either form freely. In the same way, the port number (80) is implied in most URLs, but you could quite correctly spell it out:

  • http://www.example.com:80

  • http://www.example.com:80/

  • http://example.com:80

  • http://example.com:80/

Best practice is to leave off the port number when it is 80, of course. As for whether to leave off the path when it is ‘/’, that’s a matter of personal preference. Some will argue that leaving off the ‘/’ saves a byte on an Internet crowded with bytes. Others will argue that including the ‘/’ makes it clear to readers that you’re referring to the home page of the site in question, as opposed to the site as a whole.

Next we have the question of whether to include a ‘www.’ at the start of the hostname. This is a rather controversial subject that we covered at length in Tech Times #184. In short, including the ‘www.’ is a nod to Web tradition, whereas leaving it off is bowing to current Web fashion.

Strictly speaking, neither is incorrect. Pick whichever suits you best. The important thing is to make sure that the other form automatically redirects to the form you have chosen. If your server answers to both forms without redirection, search engines will see your site as two separate sites (one with the ‘www.’ and one without), each of which will have a lower search engine ranking than if your site had a single, authoritative hostname.

You can find instructions to set up your web server to redirect to your preferred hostname at the no-www advocacy site. From its name you can tell which URL style it prefers!

As for the URL of the home page (/, /index, or /index.html), again that is largely a matter of personal style, and again the key is to choose one and make sure that the others either redirect to your preferred form, or display a 404 error page. This ensures that search engines don’t mistake them for multiple copies of the same page at different addresses.

How do you like your URLs? Trailing slash or no? ‘www.’ or no ‘www.’? Let me know by leaving a comment!

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • markrall

    I was told by a colleague that by adding the trailing slash your letting the receiving know you are looking for a directory rather than a file. This approach apparently speeds up requests.

    I’ve never taken the time to qualify the statement but I have added trailing slashes to URLs ever since.

    I also prefer to leave off the ‘www’ and ‘index.html’. It’s neater and avoids needless redundancy. http://markrall.com.au/ just looks better on stationary. But that’s my opinion :)

  • Alex (http://asolis.net/)

    I prefer no www. and a trailing slash, simply because it’s aesthetically pleasing to me. :)

  • Adam Schilling

    My preference is no www and no trailing slash, but I’d also prefer no http://. ;-)

  • Lachlan

    Anyone these days who knows their stuff is adding two www’s at the beginning.

    http://www.www.extra-www.org/

  • Vicki

    As a graphic designer, I always leave off the “www” in URLs because it takes less space, and looks a little more professional. I never put “http” before the URL on any design piece. If using the trailing slash will speed things up, I will definitely be adding more of those in my web design.

  • http://michaelherringdesign.com/ mherring

    http://example.com/ format is the illest. And therefore, the best.

  • Paul Annesley

    markrall: when you request ‘http://example.org’ (without a trailing slash) with a web browser, it’ll append the slash before making the request. The HTTP command will be ‘GET /’, and there’s no such thing as ‘GET ‘ without a path.

    But with a URL like ‘http://example.org/directory/’ – many webservers will redirect ‘/directory’ to ‘/directory/’ and this will incur the cost of an extra HTTP request. However that’s entirely up to the web server or web application – if the correct URL is ‘/directory/’ then it could validly return a ’404 Not Found’ for a request to ‘/directory’.

  • http://BusinessCalendar.Org alexbotkin

    A more interesting question is “Which would be better for more complex sites with parallel but not identical information:
    bigcity.example.com
    littlecity.example.com
    or
    example.com/bigcity/
    example.com/littlecity/
    ?
    How would these be treated differently by search engines, reacted to by website visitors, or managed by servers

    Alex

  • Lachlan

    And then how about multi-lingual content?

    en.example.com
    fr.example.com
    jp.example.com

    or

    example.com/en
    example.com/fr
    example.com/jp

    or

    example.com
    example.fr
    example.jp

    :)

  • Paul Annesley

    Adam: bah – designers :)

    Cutting down to ‘example.org’ is great for design and marketing copy, and even browser UI optimizations like in Mobile Safari and to a lesser extent Google Chrome. But the scheme (e.g. http://) is a fairly important part of a URI :)

  • Paul Annesley

    @mherring: word. http://99designs.com/ :)

  • http://www.bartwebsites.com Romuba

    I would very happily leave out the www as well as the / since it is faster to type and looks neater but having come out of the printing world I am always aware of ambiguity in copy. When there is a www almost everyone, internet challenged folk as well, know that it is a website address. When there is no www then it can be mistaken for something else particularly if the suffix is a little ambiguois like mikes.boats.net. http://www.mikes.boat.net is somewhat more clear to the internet challenged. :)

    As to adding /index, /index.html etc. I think that those who know it is there do and those who don’t, don’t need to. I’m happy leaving it out because I have had a situation where it was initially index.html, then changed to index.shtml and more recently to index.php. Each change has meant that all references had to be changed except where it had not been listed initially.

  • http://michaelherringdesign.com/ mherring

    Wait, are we talking about the best way to present URLs in print, or the best way to put URLs in an href attribute?

    For print copy, I recommend http://www.example.com
    For the href, http://example.com/ is the illest

  • http://michaelherringdesign.com/ mherring

    And the wonders of technology have added an ‘http://’ for my print copy example. That should start with ‘w’, not ‘h’.

  • http://blog.afterlight.net.au AussieJohn

    I prefer for both to at least work – my preference when typing a URL in to the browser location bar is to type the domain name only, e.g. sitepoint.com

    There are way too many sites that completely fail on this though, and you’re forced to go back to the location bar and add “www.” to the URL. If someone is visiting a domain using the HTTP protocol, it’s pretty damn safe to say that someone wants to visit the website.

    So whether you redirect “www.example.com” to “example.com” or the other way around, it doesn’t really matter – as long as a user isn’t just left hanging in cyberspace (I’ve been meaning to use that word in a sentence for a while now…)

    Ok – stop now – don’t want to rant ;)

  • VodkaFish

    For a long time I was a domainname dot com guy.

    I started adding the “www” a few years ago for a few reasons:
    - Any site I worked on a large % of users would put in “www” by default. As I interact with them, I wanted to use the same url they did (helps with fickle cookies).
    - It’s faster. Every browser defaults to domainname + ctrl+enter = http://www.domainname.com By “adding” the “www”, I was typing faster.
    - As sites started to grow, other subdomains were used. Having “www” made sense as you flipped back and forth through the subs.

  • akayani

    I always set up the server to do both.

    But I like the idea of using http://www.example.com as opposed to http://example.com in print.

    Website example.com

    or

    http://www.example.com (no need to state what it is)

    In print it’s a no brainier, in code the shortest version is the best.

  • akayani

    Oh bugger this CMS converts www to a link. Please think of the text above with http:// where www follows as missing the http://

    ;)

  • http://michaelherringdesign.com/ mherring

    @akayani, LOL. We’ve both discovered writing internet protocol examples on the internets gets dangerous.

  • http://www.aikon.com.ve joaquin_win

    I like mines without the www (depends on the url length), with ketchup and mustard :P

    I usually don’t use file extensions by working with htaccess rules

  • http://mikelward.com mikelward

    As Paul points out, appending a trailing slash will save one HTTP request and response:


    $ wget -v http://mikelward.com/about
    --2009-01-21 17:03:52-- http://mikelward.com/about
    Resolving mikelward.com... 67.205.45.190
    Connecting to mikelward.com|67.205.45.190|:80... connected.
    HTTP request sent, awaiting response... 301 Moved Permanently
    Location: http://mikelward.com/about/ [following]

    It’s probably better not to have a link to something like http://www.example.com/index.html, because tomorrow you might move to ASP, whose home page would be http://www.example.com/index.asp, and then all existing links would be broken.

  • Martin F

    This one is obvious to me, if you leave out www. you’re forced to set cookies at the global space and thus all cookies will be sent for all requests, whereas using www. allows me to set a domain they’re attached to, so if I later add blog. or forum. or ads. I don’t make users send an extra 200 bytes of cookies on every HTTP request.

    The only part of the URL where style should even be considered is after the TLD.

  • gnduke

    It also makes a difference if you are using google maps.

    Each typed version of the url needs a separate api key and a little scripting to either redirect the browser to a single url before requesting the map, or to send the correct key with the map request.

  • http://www.dimensionalized.com/new.php onefocus

    For me at Dimensionalized.com I always try to use www – however that being said, if I give out my domain by an email, or on a form, I probably will leave the www off as it is faster to type. If it is on a business card (in print, and there is room for it) I include the www. As far as the slash goes, I have always left it off. But for security reasons, if for example: http://www.domain.com/folder/index.php , I would include a slash and the index.php so that no one can go through that folder.

  • MrMr

    Keep the “www” ONLY if you pronounce it “six you”. ;)

  • Ralph Bacon

    In my websites I always use the full web site definition as it cannot be misinterpreted.

    However, when browsing the web, I always use the naked website.com only to find that even some large companies do not recognise their own domains like that and force me to prepend the www.

    My own website doesn’t have an /index.html home page; it’s actually /index.php (which of course I have set as the default). Should I in fact include an /index.html page that redirects to my php home page? Google has found me as it stands!

  • http://novemberechoromeodelta.com willkemp

    The “www” prefix was a mistake – like several other things that continue to bug us nowadays. It’s a product of the days when nobody knew how the internet was going to develop. It’s redundant and it messes up what would otherwise be a good domain name.

    I invariably set domains up so that the www version redirects to the non-www version. In print or in emails, i use the http:// prefix. I’d like to use the domain name without “www” or the scheme prefix in print, but i suspect that would confuse some people. The less people see the ugly “www”, the better – and the sooner they’ll get the hang of recognising domain names easily.

    I never type the “www” into a browser address bar. If the URL without “www” doesn’t work, i know the people running the site don’t know what they’re doing – which gives me a little extra insight into their business!

  • Tbee

    IMHO…

    Adding www just for form is a bit strange, it’s like adding “the building at” to every street address. The http prefix already denotes “www”. So you only use “subdomains” if it has practical use, for example if you have multiple webservers to loadbalance (www1.ibm.com, www2.ibm.com).

    If there is anything after the domain, then it should be a complete identifier, whether it is / or /dirname or /dirname/filename… But not partial stuff like “/index”, “index.html” is required here; there is no file or page “index”.

  • Uwe from Germany

    Scaringly enough, most state/official (German) websites add a www. where it makes even less sense such as in
    http://www.design.example.com

    because they think that anyone not seeing a www. at the beginning gets it wrong. And I think people are not used to learning anyway, they will make mistakes and others simply adapt to mistakes (which in turn prevents learning.)

    “You can find more information in the Internet under example.com” is equally wrong, but everyone says it, confusing the WWW with the Internet…

  • http://www.phoenixchange.com/ lookingglass

    Hi

    In my opinion it depends on what the question means by “right”. The answers here seem to reflect the two issues: one to do with functionality and the other to do with usability.

    The functionality issue is just about what works. Saving one byte of code here and there on the mobile/multi-media all singing and dancing web, seems to me like trying to mop up the Atlantic with kitchen towels? But the aim of links is that they … link, so making sure the server responds correctly to all the versions sounds good to me. I hope mine does! Is there anything else?

    But the usability issue is the key, and here at least I think it must be that “the shorter the better”. Hearing people having to say the “www dot” part, or trying to read long strings of text especially on stationery is irritating and tricky I find. If we can get away with not using “www dot” then great, spread the word! For similar usability reasons I use a “dot com” top-level domain – becasue it’s un-mistakable. I can’t see the taxonomy, rational or usefullness of top-level domains myself. SitePoint seems to advise buying them all for the “meaty” middle bit of the domain name to avoid brand dilution and passing off.

    BTW it would be great if any experts here could go and clean up the Wikipedia entry on Domain Names. At the moment URLs and Domains are mixed up with this use of the prefix “www dot”.

    sincerely
    robin

  • http://www.lopsica.com BerislavLopac

    The most important thing about URLs is the “R” part: resource. Web “addresses” are not things of marketing or beauty — they’re technical tools pointing to individual resources on the Web. The only thing that matters is whar an URL will return, and everything else is just a matter of personal preference.

    URLs are already quite precisely defined and standardized.

  • Baddesley

    I have to say I prefer including the wwww. visibly and in link the code, as this says “this is a web site” and not just a company name for instance. If people don’t have to type it that’s great, but it’s not a lot of hassle if you do, is it?

    This is especially important if someone prints out your page and gives it to someone. It is then obvious that it is a web site address.

  • Fr4Ev

    I like to use: http://www.example.com

    i don’t know why, just like that

  • Stevie D

    I always refer to my site as example.org (Ok, that’s not its actual know, but yanowotimean). No need to mention the www, althought it works just as well if you put the prefix in. (I do need to get around to setting up a global redirect to remove the www though)

    When you’re speaking it, it’s ten syllables less – when you’re typing it, it’s four keys less. Laziness rules!

    I’ll include the http:// in text media where that is needed to make it a clickable link (eg in emails or forums where links are generated automatically), but I’ll ignore it the rest of the time.

    Yes, Ctrl+Enter works … except when it doesn’t, such as any website that isn’t a dot-com (and there are quite a lot that aren’t!), or a lot of websites that are on a non-www subdomain. Of course, I have to slip in a word for Opera here, which will autocomplete any combination of prefixes and suffixes that you suggest in whatever order you suggest, and you don’t even need to press Ctrl+ ! (All I need to do now is to find a way to get it to ignore cybersquatters)

  • http://www.cemerson.co.uk Stormrider

    Personally, I prefer including the www (it defines that it is the web server you are after, rather than, for example ftp, which a lot of browsers support). I will also put the trailing slash in usually as well. You have to include http:// for most browsers to make the link work properly…

  • Narshada

    Personal preference is no www, no index.htm & no trailing slash. It makes the url easier to read, especially for non-tech users and therefore easier to remember, although after years of being told to put www in front, that may be debateable. As long as things redirect correctly, the difference to the end user is minimal.

  • http://BusinessCalendar.Org alexbotkin

    If it’s of interest, the no-www.org site appears to be a dead site. Email bounces, and ownership is hidden behind Domainsbyproxy.com

  • Bushwomen

    I like my urls without the http://WWW., I happen to think that the http:// is an important part of the url and does im-part to the non-internet peoples that it is an internet url.

    I suppose it all depends on the individual and their preferences.

    A website I regulary visit http://wildcrafts.org.uk seems to be ok with its urls and so does http://bearclawbushcraft.co.uk

    Just my experience of the web and urls so far :-)

  • perreault

    There are two statements in the article that I’d debate. First is the statement that both with and without the “www” are technically not correct. I disagree. Technically, the “www” version IS correct, assuming “www” is the host upon which the website is hosted. Now, that host might be a physical machine host name, or it might be the virtual host name, but a host name is technically required. Not using the host name is ambiguous. Now, whether someone wants to leave off the “www” or not is their preference since DNS allows this in practice. And as long as both versions work that’s really all that matters. Personally I use the “www” because I feel it is better understood. Third parties linking to me more often than not will use the “www” version. If I want to maximize the worth of inbound links, I want to be sure they all refer to my website the same way that I do. So I use the “www” as they do.

    And none of them know, or even care, what the name is of my default page (is it index.htm or default.aspx for example). For that reason, I ensure that my index page and all internal references always revert to the website name without appending the index page name. This makes the internal references consistent with inbound external references.

    Second, in my experience I have found no difference between having the “www” and “non-www” versions both work. We have some websites where we do this and some where we use a 301-redirect to the “www” version. We also have some sites that have multiple hosts and some with sub-domains that also have multiple hosts. For the most part I have found that Google considers the entire structure as one big happy family. This is especially true of the “www” and “non-www” versions, but they also tend to include other hosts in the mix as long as they are in the same domain.

    I haven’t found any compelling reason to set up the 301 redirect versus two separate sites (or any compelling reason not to do so).

    As for the trailing slash, I leave it off in print, but I have noticed that no matter what I do, if I type in a website home page address (e.g. sitepoint.com), every browser I use will automatically append the trailing slash.

  • agentolivia

    When I watch my not-so-tech-saavy friends and family type in URLs into the address bar, I’ve noticed that they type as little as possible…usually just “example”, which actually works for them most of the time. If not, they go to Google and type in the URL (this time, “example.com”) and click on the top result. So from a usability perspective, I try and make sure that the server is configured to get the person to the page they intended to get to with as few words and slashes as possible. Since many people still refer to forward or trailing slashes as “back slashes”, I think leaving out trailing slashes in references to top-level domain names may lessen confusion (perhaps by only one byte, but still…;-)

  • Silver Firefly

    I use example.com both in print and in my location bar. I redirect my URLs on my web server to point to http://example.com.

  • HJF

    We should use “www.” to indicate that it’s a regular web site intended for a conventional web browser, as opposed to a “wap.” site for mobile phones, an “ftp.” repository or “webmail.” interface. There are dozens of commonly used sub-domains and “www.” is the default for sites accessible via the World Wide Web.
    Keeping the “www” removes ambiguity but because people don’t like saying it they’re trying to abolish it, which is counterproductive.

    When referring to the index page of a web site we need state only the domain* to the user since the suffix of the index ‘page’ may well be “.htm”, “.html”, “.php”, “.asp” or whatever. Indeed it might even be called “default” instead of “index”; all of which may be subject to change.
    * For simplicity, I use the term ‘domain’ to mean “www.example.com”, or if you prefer “example.com”.

    We need only show “www.example.com” as link text for users to understand where the link goes, but we should use “http://www.example.com/” in our code to inform the browser that we’d like to use hypertext transfer protocol to request the index file of the root directory (as signified by the trailing slash) at that domain.
    Including the trailing slash in URLs for directories, root or otherwise, requires one less http request to retrieve the index page of that directory. Saving one byte in the link code is not a good trade-off.

  • JWG Design

    Perreault, thank you for saying what I was thinking. The “www” is definitely correct when your web server’s host name is “www” whether actual or virtual. The same goes for “mail” when it comes to mail servers. The actual computer that hosts a web site at “www.example.com” might be different than the computer providing mail services at “mail.example.com”. It is certainly not a requirement that they be the same server, although quite often they are. For that matter, you could setup a mail server at “www.example.com” and a web server at “mail.example.com” and that would be perfectly correct – though rather confusing to end-users. Likewise, as someone else pointed out, a domain could have several web hosts providing entirely different content (ie. “www.example.com” and “support.example.com”)

    My understanding is that including the “www” is the proper way to write it, although omitting it in reference to a site is a common and accepted practice ever since the “dot-com” boom. Even capitalization is fine when merely referring to a site – although when writing links or referencing specific pages of the web site, the full address should be used. An example would be writing “Example.com” on a letterhead or business card, yet writing “www.example.com/specificpage.htm” when referring to a specific page.

    Also, a directory should be followed by a slash (ie. “www.example.com/directory/”), yet a file should not (ie. “www.example.com/file”)

    The “http://” is not part of the address; it is a protocol for providing access to the information at the address specified. So “http://” or “mailto://” or “ftp://” should be used in HREF links or typed links when you need the URL to be functional, yet should never be considered part of the address.

  • http://fcOnTheWeb.com ferrari_chris

    I generally go with no www and no trailing slash.

    Although I think I may add a trailing slash now that I’m aware it causes an extra http request – I don’t know why I didn’t think of that before.

  • http://mikelward.com mikelward

    Ferrari, as others point out, the trailing slash is automatically appended for example.com, just not for sub-pages like example.com/about.

    Of course, there are benefits to omitting the trailing slash, a link to example.com/about could actually be example.com/about.html or example.com/about/index.html, and the user doesn’t have to care which.

    Wasn’t advocating adding a trailing slash, just saying it does incur some slight extra overhead.

  • Peter

    I’d suggest that the “correct” URL in print for this example is really a domain: http://www.somecompany.com. For pages that need to be buried in the hierarchy I use http://www.somecompany.com/folder/ Exposing a file name simply allows for more typos: was it “default.htm” or “default.html” or “default.shtm” etc.

    Although adding the slash does cut the number of web requests by 1 if a user is going to type it in a browser they are likely to leave it off. However, starting with “www” clearly signals to the reader that what follows is a link. Leaving the “www” (or “dubdubdub”) off means the reader doesn’t get this information until the end of the link. Extending this logic, adding “http://” adds 7 more characters, but doesn’t add any information to “www”

    “Correct” here means what’s best for your audience. In the end the most important thing is to be consistent!

  • http://blog.afterlight.net.au AussieJohn

    @Stormrider:

    Personally, I prefer including the www (it defines that it is the web server you are after, rather than, for example ftp, which a lot of browsers support). I will also put the trailing slash in usually as well. You have to include http:// for most browsers to make the link work properly…

    Most modern browsers will allow you to type the URL without the http:// part – because you are typing a domain name into a web browser the http:// part is implied.

    Because of this, the necessity for having www at the beginning of a domain name typed in a web browser is obsolete. As you say, many browsers support FTP as well, but you have to type in “ftp://” to specify the protocol.

    I myself am of a bit of a mixed opinion about the www / no-www debate. Yes, the www indicates that it’s the web server that you’re visiting, but I don’t believe it should be the only way to get to the domain, especially if the protocol is defined.
    In addition to this, the www is so ingrained in our culture that many people have trouble shaking this paradigm.

    The one thing that I am certainly not sitting on the fence about is that both www and non-www domains should do something and go somewhere.

    It is one of the things I greatly dislike about a website, when I try to go to example.com and nothing happens, I just get a DNS error. It should at the very least redirect to the www domain

  • linux-mike

    Y’all forgot the single most usefull reason for leaving the www on an URL. The regex patterns of your e-mail program are generally set up to recognise www.example.com and automatically make it a hyperlink. So you just gotta use it, like it or not.

  • linux-mike

    Hell even the regex pattern matcher of this forum recognised it too and appended the http://. I had used lt; strong gt; www dot lt; /strong gt; example.com and you see what it did above.

  • http://blog.afterlight.net.au AussieJohn

    @linux-mike:

    That seems a really bad reason to use www on a URL. If you want links in emails, why not make them links?

    Besides, Gmail, Hotmail, Yahoo and Outlook all make links out of domains without the www, I presume other email clients behave the same, and even if they don’t, who cares because if the author of the email really wanted to make it a link then they should have made it a proper link (presuming it’s a HTML email – if it’s a plain text email it shouldn’t turn in to a link).

  • cloosley

    Performance is a vital aspect of Web site usability, and including the trailing slash has been a standard part of lists of Web performance guidelines for more than 10 years. The first edition of Patrick Killelea’s book Web Performance Tuning was published in 1998, and you can find it (at #10) in his top ten tuning tips by googling “Patrick Killelea’s Top 10″.

    I don’t really recommend Killelea’s book, as it is dated now. But a more complete discussion of this performance issue appears in the book High Performance Web Sites by Steve Souders of Yahoo. Googling “How Redirects Hurt Performance” will produce some links to that discussion, including an excerpt in Google books.

    (I tried posting a link to this previously, but Sitepoint’s spam filter ate my post, maybe because I’m referencing books by another publisher? ).

  • Phil Singer

    As for the URL of the home page (/, /index, or /index.html), again that is largely a matter of personal style, and again the key is to choose one and make sure that the others either redirect to your preferred form, or display a 404 error page. This ensures that search engines don’t mistake them for multiple copies of the same page at different addresses.

    Has something changed in the last few years (when I’ve been doing more database work than web development). The ROT used to be to always include a trailing slash, just for efficiencies’ sake. I thought that leaving it off forced a 301 error and an internal redirect while the web server figured out that the file it thought you were requesting was really a directory, and it had to look up the default page (if any).

  • http://www.sitepoint.com/ Kevin Yank

    The ROT used to be to always include a trailing slash, just for efficiencies’ sake. I thought that leaving it off forced a 301 error and an internal redirect while the web server figured out that the file it thought you were requesting was really a directory, and it had to look up the default page (if any).

    As Paul explains above, that is true for URLs that point to a directory within your site, but the root directory is a special case. If a URL does not contain a path at all, it automatically adds a ‘/’ to the URL before making the request. Consequently, there is no inefficient redirect triggered.

  • http://www.cemerson.co.uk Stormrider

    @AussieJohn:

    Most modern browsers will allow you to type the URL without the http:// part – because you are typing a domain name into a web browser the http:// part is implied.

    I know that, I was referring to hyperlinks within a website. The http:// is required there.

  • http://blog.afterlight.net.au AussieJohn

    @Stormrider:

    Sorry for misunderstanding, I thought you were talking about typing a domain into the location bar of a browser.
    The http:// is of course required to define the protocol of the link you are sending someone to :-)

  • Stevie D

    @AussieJohn:

    Besides, Gmail, Hotmail, Yahoo and Outlook all make links out of domains without the www, I presume other email clients behave the same, and even if they don’t, who cares because if the author of the email really wanted to make it a link then they should have made it a proper link (presuming it’s a HTML email – if it’s a plain text email it shouldn’t turn in to a link).

    Most email clients will turn a URL into a clickable link in plain text emails – this often requires at least http or www – not all clients would recognise, eg, example.org or even example.com

  • Wernight

    I think the article says “whatever is fine it’s all personal choices” but that’s missing the most important points:

    1. Good URLs do not change (to make it sure some advise to use a year before putting a cathegory in the URL, so that later the meaning can change but URL remain same).

    2. From (1) index.html should not be; else what if index.html become index.php, index.asp, or no more index file (like Django URLs by default).

    3. The real problem comes from multilingual URLs where actually there are two basic choices:
    A) Domain (ex: example.fr)
    B) Folder (ex: example.com/fr/)
    In over-summarized way: (A) is preferable for a website custom tailored for a specific country taste. (B) is preferable for the same content translated in different languages.

  • tiggsy

    www. is recognized by non-savvy users much more easily, and the trailing slash is odd looking to them, so i stick to: http://www.domain.com mostly (though in some cases, like on yahoo answers, where the url gets truncated, I sometimes drop the www so that the whole thing is visible!)

  • Aarem

    Aw, why is it always I who have to ask the dumb questions?

    Kevin: “You can find instructions to set up your web server to redirect to your preferred hostname…”

    On that site is says:

    —-

    It’s a fairly simple process, actually. Create a file called .htaccess and paste the following lines, changing the domain name to match that of your site:

    Apache Webserver:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    —-

    OK, so HOW do you change the domain name to match that of your site? An example would help. This is gibberish to me.

    And then you read stuff like this, from
    http://httpd.apache.org/docs/1.3/howto/htaccess.html

    “In general, you should never use .htaccess files unless you don’t have access to the main server configuration file… [reasons follow]”

    Now I’m totally confused.

  • http://www.sitepoint.com/ Kevin Yank

    Aarem,

    Assuming your site is running on Apache, and the mod_rewrite module is enabled (this is true on the vast majority of hosts), you can use the code you quoted without changing it at all.

    Here’s what the three lines do:

    RewriteEngine On

    This switches on the mod_rewrite module.

    RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]

    This sets a condition for the rule that follows on the next line. It checks the hostname of each incoming request, and if it begins with “www.”, it applies the rewrite rule.

    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    This last line is the actual rewrite rule. It sends a HTTP 301 redirect to the browser, pointing it at the same URL that was requested, only with the “www.” stripped off the start of the hostname.

    Note that the protocol (http://) is hard-coded in this rule, so it will redirect https:// requests with a “www.” hostname to an http:// URL. If this is a concern, you’ll need to talk to an Apache mod_rewrite expert to write a more sophisticated set of rewrite rules.

  • Aarem

    Many thanks, Kevin! Very clear and helpful answer.

  • Karen Passmore

    Good article

    When I speak to someone and tell the a website address, I’ll leave off the http and www. I think folks are getting it now when you say.. go to… dogs.com instead of what seems like the long winded http://www.dogs.com
    In written form 90% of the time I do leave on the www, and will do so until a generation moves up the age ladder, the generation that still doesn’t get it.

    HEY a frustrating topic I come across with basic web users. If they ‘know” the exact website address they still do a Google search instead of saving a step and inputting the address in the correct location. Karen

  • http://www.wynnefields.com/ Wynnefield

    When creating hyperlinks, I always use the full nomenclature, http://www.example.com/ with the “http” prefix and trailing slash suffix. Most of the time when typing URI’s or otherwise (unless designing a business card or other business collateral on which I remove the prefix and suffix), I use the full description, as well, from years of habit.

    This is a result of early years of SEO study and learning search engines indexed the following URI listings as six separate entries, although each link results in the same landing page:

    http://www.example.com/index.html
    http://www.example.com/
    http://www.example.com
    http://example.com/index.html
    http://example.com/
    http://example.com

    If search engines identify each of these as a unique page as they index the links, the inbound link relevance becomes weaker rather than stronger. I always send others the full URI description for links to my site and/or weblog (and in signature files and forum/weblog registrations) in hopes they will use it for the same reason.

    However, I believe the important question of a URI structure is not necessarily which of the above listed versions to use, rather than be consistent with the choice. This will ensure the highest level of relevant inbound links to the same indexed page(s) on the site.

  • Fly on the wall

    I like my urls with the forward slash of, but like to keep the http:// on as I feel this is essential to letting non web people know its a web address.

    For example http://mythingoryourthingto.com (fictitious address)

    Just think it looks a whole lot more professional

    I do not agree with bushwomen on the bit below:

    I like my urls without the http://WWW.

    (The above)I do not agree with as I feel the http:// is important and is traditional in a url.

    Also had a look at the link bushwomen regulary visits http://wildcrafts.org.uk but feel that the page http://wildcrafts.org.uk/custserv.html is much neater, the website is ok but still room for development however nice simple logos to make navigation easy for the customer.

    Does anyone on here know how to hide urls? and is it important as to how you reference a internal url as well as just an external url?

  • Anonymous

    Enough of the ‘personal preference stuff, please, and a few more facts and statistics.

    From the article: “Strictly speaking, neither is correct.”
    Actually, including www IS correct, assuming that is your host-name. As one who deals with large corporate structures, being able to handle sub-domains is essential, and this is far easier to explain to everyone if you can say: “Replace the ‘www’ with ‘new-sub-domain-name’ in the address bar.”
    In print, and on the phone, it is far easier for everyone to recognise that w w w .example . com is a URL (even if they don’t know what one is) Try something slightly less obvious, like asdf.org and only the savvy will recognise it.

    Finally, anyone care to submit a .htaccess sample for adding www to a URL? Not convinced that one is ever needed, though.

  • antirealm

    Interesting points of view. I see several sections here:

    1. Print & Screen

    Business cards should have a small URL as http://www.verylongdomain.com/anal/retentive.html sucks, omit the www. Larger prints could have a “www.moreinfohere.com” without the http://, but include the www. If you’re unsure whether your audience is internet-aware, just put www, and conform to the net’s tradition.

    If displaying a link on the screen that is clickable, don’t add extra nonsense like www. In fact, a lot of the time a link’s text should not contain a url. If it’s in a video just put “www.example.com”, easier to READ.

    3. Functionality (HTML/CSS/etc) and SEO ($$$$):

    Not putting a trailing / doesn’t save a byte it wastes more bytes and time with useless redirection requests. A link is meant to help the user go to other pages, so it must be functional. Not including a “www.” will save you a grand total of 4 bytes, so in other words, if you are removing it to save bandwidth on your server you are probably too anal retentive and have more personal problems than bandwidth considerations. Consider chopping down your JPGs, GIFs, and PNGs to save much, MUCH, *MUCH* more than the “www.” saving.

    If you are losing thousands of potential dollars because your server is configured in a Google-Unfriendly way, then perhaps you should consider reconfiguring your server, until something better than Google takes over. If your site becomes popular enough, maybe you could tell us all how to do it the best.

    Consider a more user friendly scheme using mod_rewrite on apache and the like. example.com/register is not only nicer than example.com/register.(php/asp/jsp/html/shtml/etc) but it also fixes the other URI problem. If you change your site internals completely, you can still map your GENERAL URIs to your new application, without having to change your homepage all over the net, or introduce lame redirection pages/etc.

    4. Speech

    If you don’t like saying “double-you, double-you, double-you” then don’t, unless it’s someone who won’t understand you unless you say it. If you are unaware if they will know or not, try www, or don’t. Say “six-yous” if you want to introduce confusion or introduce a new fad. Under rare circumstances you will need to include the http:// in speech, unless there is an extreme importance in mentioning that its not gopher://, ftp://, or torrent:// (^.^), etc..

    In short, do whatever it takes to make your site work well, and generate lots of bank-overflowing dollars.

  • Anonymous

    If you are going for the mainstream market missing out the www only serves to confuse joe public/plumber.

    Don’t care much for URL rewriting too unless the site is massive. Devising well laid out navigation is time better spent. If there is any SEO benefit it will soon be factored out by the search engines.