Can . (period) be part of the path part of an URL?

As others have noted, periods are allowed in URLs, but be careful. If a single or double period is used in part of a URL's path, the browser will treat it as a change in the path, and you may not get the behavior you want.

For example:

  • www.example.com/foo/./ redirects to www.example.com/foo/
  • www.example.com/foo/../ redirects to www.example.com/

Whereas the following will not redirect:

  • www.example.com/foo/bar.biz/
  • www.example.com/foo/..biz/
  • www.example.com/foo/biz../

I don't see where RFC1738 disallows periods (.) in URLs. Here are some excerpts from there:

hpath          = hsegment *[ "/" hsegment ]
hsegment       = *[ uchar | ";" | ":" | "@" | "&" | "=" ]
uchar          = unreserved | escape
unreserved     = alpha | digit | safe | extra
safe           = "$" | "-" | "_" | "." | "+"

So the answer to your question is: Yes, http://www.example.com/module.php/lib/lib.php is a valid URL.

Tags:

Url

Rfc