Jens Oliver Meiert

Get 15% off on select books on Gumroad—use discount code “testdrive”.

A URL Policy for Web Projects

Post from August 22, 2013 (↻ June 9, 2021), filed under .

This and many other posts are also available as a pretty, well-behaved ebook: On Web Development.

Do your projects suffer from URL inconsistencies? I just noticed how mine do. I also noticed that I did some unnecessary things, like omitting protocols when they were actually useful. And I noticed that I’ve seen similar problems in corporate projects before. So I jotted down a quick “policy.”

  1. Use the shortest available, non-redirecting URL. For example, make all site references relative if possible; root-relative URLs (/foo) may be allowed on pages that serve as their own error pages. And, of course, omit “index.html” and other files names if they effectively serve as a DirectoryIndex. (Reason: more focused.)

  2. Don’t omit the protocol unless the host site is available through both http and https. (Reason: faster—to avoid http to https redirects, assuming a http host site with links to target sites that live on https.) [There are still use cases for protocol-less URLs but this here has been outlived by increased focus on security.]

  3. Prefer https over http references. (Reason: more secure.)

  4. Be consistent per site. (Reason: more maintainable.)

Mileage may vary, so this is more of an idea for other projects’ URL policies. Maybe you have a preference for absolute URLs. Maybe you have an SSL certificate, in which case you want to force https. Maybe you’re not as concerned about consistency. And maybe you see something that I missed, or found something to work better?

About Me

Jens Oliver Meiert, on September 30, 2021.

I’m Jens, and I’m an engineering lead—currently manager for Developer Experience at LivePerson—and author. I’ve worked as a technical lead for Google, I’m close to W3C and WHATWG, and I write and review books for O’Reilly. I love trying things, sometimes including philosophy, art, and adventure. Here on I share some of my views and experiences.

If you have a question or suggestion about what I write, please leave a comment (if available) or a message. Thank you!

Read More

Maybe this is interesting to you, too:

Looking for a way to comment? Comments have been disabled, unfortunately.

Cover: The Web Development Glossary.

Get a good look at web development? Try The Web Development Glossary (2020). With explanations and definitions for literally thousands of terms from Web Development and related fields, building on Wikipedia as well as the MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.

Stay up-to-date? Learn about new posts by feed or on Twitter.

Found a mistake? Email me,

You are here: HomeArchive2013 → A URL Policy for Web Projects

Last update: June 9, 2021

Professional frontend developers produce valid HTML and CSS.