Recently released was the second edition of one of SitePoint's most popular books, Build Your Own Web Site The Right Way Using HTML & CSS, by Ian Lloyd. It's a great book for absolute beginners. Ian is giving away 5 free copies of his book and all you have to do is convince him to give you one.
Also, if you missed out on a copy of The ActionScript Reference for Building RIAs as part of last week's giveaway, remember you can still download a free PDF of the book -- read the article and complete the quiz to grab a copy.
In this issue, continuing our "the Web is all about links" theme, Kevin looks at URLs and examines the question of what makes a good web site URL.
SummaryWhich URL is Right?
by Kevin Yank
Following Andrews's look at good hyperlink text last issue, 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.htmlWHICH 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.
More URL advice after the ad...
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 correct. 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:
|
Create Engaging, Cross-Platform RIAs with Adobe Flex
Flex is a free, open source framework to quickly and easily build and maintain expressive web applications that deploy consistently in the browser using Adobe Flash® Player software, and on the desktop using Adobe AIR runtime.
Use your existing skills and code to create applications that are powering Web 2.0 and get them to market quickly.
See you next week for another issue of the Tech Times!
Andrew Tetlaw
techtimes@sitepoint.com
SitePoint Technical Editor
No comments:
Post a Comment