Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

url

rfc

Is the following URL valid?

http://www.example.com/module.php/lib/lib.php

According to https://www.rfc-editor.org/rfc/rfc1738 section the hpath element of an URL can not contain a '.' (period). There is in the above case a '.' after "module" which is not allowed according to RFC1738.

Am I reading the RFC wrong or is this RFC succeed by another RFC? Some other RFC's allows '.' in URLs (https://www.rfc-editor.org/rfc/rfc1808).

like image 714
Moffe Avatar asked Sep 26 '11 13:09

Moffe


People also ask

What characters are allowed in a URL path?

So it's basically A – Z , a – z , 0 – 9 , - , . , _ , ~ , ! , $ , & , ' , ( , ) , * , + , , , ; , = , : , @ , as well as % that must be followed by two hexadecimal digits. Any other character/byte needs to be encoded using the percent-encoding.

Can a path contain a dot?

For whoever is also looking into the spec: At the end you can see that path can contain segment and segment can contain xpalpha which can contain xaplha which can contain "safe" which can contain a dot.

What does a period in a URL mean?

It doesn't mean anything. You could have an URI like http://example.com/all.those.periods. – PeeHaa.

What is a path URL?

A URL (Uniform Resource Locator) identifies a resource on a remote server and gives the network location on that server. The URL path is the string of information that comes after the top level domain name. You can use the HTTP-proxy to block websites that contain specified text in the URL path.


1 Answers

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.

like image 118
Adam Batkin Avatar answered Sep 20 '22 07:09

Adam Batkin