3

I'm building a small system, which has nice htaccess rewritten urls. Now I'm wondering if it's a good idea to use colons for it. Here's an example:

domain.tld/section:Foo/page:12

It's a lot more stable than something like this, as it describes every string:

domain.tld/section/Foo/12

The only problem is, will all browsers support it right? I know Wikipedia uses them :)

Matti Laine

Martti Laine
  • 12,315
  • 20
  • 64
  • 101
  • Yes, all browsers support it. It's not as good as it looks like for SEO, for instance .. if that has any relevance to you... – yoda Feb 07 '11 at 14:38

3 Answers3

1

It's highly unrecommended. It's not standards-compliant, and can cause some trouble.

See: Is a colon safe for friendly-URL use?

Community
  • 1
  • 1
Ofer Zelig
  • 16,560
  • 8
  • 54
  • 90
  • That question is about making sure that "no colon [...] will be url-encoded by browsers". That doesn't mean they are not safe and, if fact, not the same question *at all*. – Andrew White Feb 07 '11 at 15:00
  • You are right Andrew, but I wanted to point out that a decision to support colons might introduce other [unexpected] problems, not necessarily on the client side. – Ofer Zelig Feb 07 '11 at 15:29
0

Yes browsers will be fine with it. However, I don't see why it's more "stable" than the usual /Foo/12. The whole point of url-rewriting is that you don't expose what the parameter names are (i.e. ?section=Foo&page=12). If you're just putting parameter names back in then what was the point?

OrangeDog
  • 33,501
  • 12
  • 115
  • 195
0

The colon is fine browsers; will URL encode any characters that would cause problems. The later form (using slashes) is more inline with the REST architecture which will probably be more recognizable/standard if you plan on offering something like a webservice in the future.

Andrew White
  • 51,542
  • 18
  • 111
  • 135