5

I know it can't be part of the authority section as usernames with an @ are used there, but can I use it in the path section.

The reason I want to use it is as part of an url for a users resources. eg

www.example.com/user@domain.com/someresource

SystemicPlural
  • 5,629
  • 9
  • 49
  • 74

2 Answers2

7

The @ symbol is a reserved character in RFC 3986 so it is not allowed in your URL. It would be converted to %40 when URL encoding is used.

Community
  • 1
  • 1
Brett
  • 3,825
  • 3
  • 24
  • 27
  • I was going to say similar. But then started trying to decide what "If data for a URI component would conflict with a reserved character's purpose as a delimiter ..." is trying to highlight. And then, of course, `/` is also a reserved character, and I'm fairly sure you're allowed those in a URL. – Damien_The_Unbeliever Jun 14 '13 at 10:20
  • `/` is allowed when being used for its reserved purpose. It is the same for `@` which can be used in the authority part of the URI, but not anywhere else. – Brett Jun 14 '13 at 10:53
3

In your case, best practice for RESTful and nice URLS, it should be www.example.com/domain.com/user/someresource

igo
  • 6,359
  • 6
  • 42
  • 51