Are colons allowed in URLs?

Emanuil Rusev picture Emanuil Rusev · Nov 15, 2009 · Viewed 15k times · Source

I thought using colons in URIs was "illegal". Then I saw that vimeo.com is using URIs like http://www.vimeo.com/tag:sample.

  1. What do you feel about the usage of colons in URIs?
  2. How do I make my Apache server work with the "colon" syntax because now it's throwing the "Access forbidden!" error when there is a colon in the first segment of the URI?

Answer

Gumbo picture Gumbo · Nov 15, 2009

Colons are allowed in the URI path. But you need to be careful when writing relative URI paths with a colon since it is not allowed when used like this:

<a href="tag:sample">

In this case tag would be interpreted as the URI’s scheme. Instead you need to write it like this:

<a href="./tag:sample">