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?

Comments

I've seen URL's that contain : too.

Written by Geo

... and it wasn't for the port.

Written by Geo

Can you give an example?

Written by Gumbo

I've seen something like this site.com/browse:section?id=1

Written by Geo

For reference, colons don't seem to be specifically disallowed at that point by RFC2396 section 3.3 ietf.org/rfc/rfc2396.txt

Written by Tim

It's fine. It might break naïve programmers' simple regexp-based URL-parsing hacks, but they deserve to be broken. :-)

Written by bobince

Accepted Answer

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">
Written by Gumbo
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki