Categories
Computing Web Development

How browsers detect whether the URL points to a file or a directory

Suppose you are a browser and you get a URL like:
https://www.enavigo.com/awesome
How do you know if awesome is a directory or a file?
A really nice hint you’d be nice to give is to append a slash to the URL whenever you denote a directory.

So how *can* you find that out?
The only way I found out had to do with headers. It appears that when web servers are sent a URL like https://www.enavigo.com/awesome and awesome *is* a directory, the response header will redirect the browser (or requestor for that matter) to the properly specified URL
https://www.enavigo.com/awesome/ which has the trailing slash character. I am sure that has to do with server setup.

Need to research this issue more…

Share
Share