4

For example the web page I'm on now is:

https://superuser.com/questions/ask

not:

https://superuser.com/questions/ask.html

https://superuser.com/questions/ask.php

I've noticed this for all kinds of sites. Do the developers just not bother putting suffixes on the files?

3 Answers 3

5

It's important to remember that a URL is a way to specify a resource. This resource can be of any type. In simpler sites, the resource is requesting a file located in a given folder on the server. But it is become much more common for the URL to be less of a direct 'give me this file', and instead be parsed by a web engine.

In these more advanced sites (or at least more driven by custom software), the URL is more a directive to the software rather than a specifier for a particular file, and so has no reason to include an extension (which is merely a way for operating systems to conveniently tell what kind of file something is).

You are not requesting a file on a site like superuser; you are making a query against a API (so to speak). So it has no need for a file extension.

1

StackExchange is an ASP.NET MVC application. MVC means Model, View and Controller. The URL https://superuser.com/questions/ask is saying go to the 'questions' controller and find me the 'ask' method which will then turn around and render a view back to the user. So in one way you're not actually navigating to a page, you're navigating to a programatic method located on the web server.

Secondly, there are other sites which may have a URL like https://superuser.com/questions/ask which are actually re-writing the url in the background so instead of http://superuser.com?q=123&a=789, you'll get the pretty URL of https://superuser.com/questions/ask. This type of background work can be found in applications like WordPress.

Hope this helps explain this for you.

0

These "files" are often actually directories. Most servers allow a developer to specify a default index file (usually index.html), such that the URL for a directory can be entered without the individual filename. For example, Apache will allow you to configure this using the DirectoryIndex directive in the .htaccess file:

DirectoryIndex index.html

And then a request for the directory containing an index.html will be served with the index file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .