Search code examples
phpasp.netjakarta-eewebserver-side-scripting

Get the filetype of a webpage


Is it possible to get the filetype of a webpage. I see sometimes webpages like:

random.com/game

What is the filetype of game?

I can of course try to guess the filetypes, such as game.html, game.php etc. but is there a way to get it?


Solution

  • No, it's not possible. There are several reasons for this:

    1. /game could be a sub-directory. In this case, the file could be one of any default index pages for the web server serving the page.

    2. /game could be configured via server routing to point somewhere completely different on the site.

    3. /game could be a route in a web application. In this case, there's no single file for the page. The server could route the request to application code which uses any number of files to construct the page.