Celeb Glow
news | March 14, 2026

Why is there no error when I enter many slashes in a file URL in a browser?

On my Windows 10 machine I can enter a file URL of a local directory (e.g. file:///D:/temp), or a local file (e.g. file:///D:/temp/homepage.html) and everything works fine.

However, wherever there is a forward slash in those valid URLs, I can insert many more, and everything still works fine. For example:

file:///D://///////////////////temp///////////////MiscTests///////

Also see the screenshot from Chrome:

At first I thought this was a bug in Chrome, but Opera, Edge and Firefox also do the same thing so I assume that the URL is perfectly valid.

As a related issue, it's worth noting that those browsers also allow multiple slashes in a web URL (e.g. ), though in that scenario the URL in the address bar gets corrected to . So it's not just file URLs that allow many slashes.

Is there a good reason for the browsers allowing all those slashes, or is it an oversight in some specification that can't be corrected?

1 Answer

RFC3986, section 3.3 says multiple slashes are valid in URLs.

The / in a URL determines where segments of the URL are split. A double slash (outside the authority delimiter, which is the first //) would yield an empty segment, which according to RFC 2396 may be ignored. Technically a webserver could throw an exception on this, but users expect webservers to handle this sort of thing, so it just ignores it.

Btw, this also happens on Unices (which the web was arguably modeled after):

The Single Unix specification section 3.266 defines that multiple slashes can be considered as one:

A character string that is used to identify a file. In the context of IEEE Std 1003.1-2001, a pathname consists of, at most, {PATH_MAX} bytes, including the terminating null byte. It has an optional beginning slash, followed by zero or more filenames separated by slashes. A pathname may optionally contain one or more trailing slashes. Multiple successive slashes are considered to be the same as one slash.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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