After reading these answers and some Googling I couldn't find a precise answer. RFC states that these characters are unreserved

"-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"

How can . be unreserved? Isn't that the base of a domain? eg. www.google.com/index.html

Further, it is mentioned in the same RFC that these characters are unwise as some services might use them as delimiters. I've never seen these being used in such s way. Have I just not been paying attention?

"{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"

My intention is to build a redirect service which would anonymize resources. say location.com/Vzb16-8es9a/Gk7sL3j@+q. I want to generate these 10 char random strings without causing misinterpretations on the receiving side, which could really be anything. I close to understanding until I read the period is unreserved.

I hope someone can shed some light on these as I am thoroughly confused as what's safe and what's not .

  • 1
    The characters reserved in the domain portion of the URL are different than those reserved in the path portion of the URL. It looks like you are mostly concerned with the path, correct? Oct 28, 2020 at 14:20
  • You are correct, I'm mostly concerned about the portion denoting path, *however the .html could exist in the path. I wouldn't want . to cause undesired results Oct 28, 2020 at 14:24
  • Why do you need such long URLs with so many characters? Even if you stuck to just the 26 letters in both cases + 10 digits, 7 characters would give you 3.5 trillion possible URLs. Oct 28, 2020 at 14:25
  • 1
    Way too long unless you have some reason I'm not seeing. Oct 28, 2020 at 16:06
  • 1
    For your use case there are enough different chars without resorting to "special" chars. It's not really a case as to which characters are technically permitted in the URL-path, but using any special non-word characters are potentially going to cause problems for users copy/pasting/sharing (and even typing) these URLs.
    – MrWhite
    Oct 28, 2020 at 19:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.