Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Some websites, no matter what page you're on, always just show their domain name in the address bar and nothing else.

And many show the folders, e.g., but don't show the actual file, which would be like http://domain.tld/folder/file.extension.

How are both accomplished?

share|improve this question
up vote 9 down vote accepted

This is because of a bit of a misconception with what a URL actually is, probably helped by the days of static .HTML files and PHP scripts.

Traditionally, everything past the TLD is a pointer to a specific file. Say a blog post is located at Without the use of fancy techniques, it would mean that there is a folder called blog, and in that is a 2009 folder, and in that a folder for every month, and in those folders ANOTHER folder for every day of the month. Clearly, this gets very complicated very quickly.

That is why web servers (such as Apache) and programming languages (such as PHP) invented URL rewriting. What that does is converts the said URL into something a bit more manageable, such as Here, a the articles.php script will use the provided post ID to look up the applicable post, then it will display the post, but the user would still see the URL as

Another approach just scraps all this entirely. Everything past the TLD (in this case, /questions/56772/website-url-hiding-hiding-file) is merely a pointer to content, not necessarily a file. Some websites, such as Super User, a built using a MVC (Model-View-Controller) approach. Usually, this involves a list of URLs for a website, and maps them to the applicable functions and code in order to display that page. For example, Super User might look like this1:

'' > displayFrontPage()
'' > displayQuestionsList(sorted=default)
'<QuestionID>/<QuestionID>' > displayQuestion(question= QuestionID)

This would most commonly be placed in a file by itself. I a common layout might be:

          controller.aspx (which contains the list of URLs and points to a view in views.aspx)
          views.aspx (which contains all the code for the superuser, such as displayFrontPage() and displayQuestion(question= QuestionID))
          models.aspx (which contains information about the table in the database.)

1Please keep in mind that I have no idea how the controller works for ASP MVC (I am more of a Django guy), so this probably isnt that accurate. It is just an example

share|improve this answer
Where would that code be placed? – Mk12 Oct 17 '09 at 23:48
It would depend on the server configuration or the actually framework being used. I will update my question appropriately. – Josh Hunt Oct 17 '09 at 23:53
What about google, for instance, notice search has no file extension… – Mk12 Oct 18 '09 at 19:38
@Mk12: The programmer can choose to use any URL he/she wants. I could write a web application that puts .php at the end of every URL, when in fact there are no PHP files anywhere on the server. So Google decided to simply use "search" without any extension. They could have done something like this, if they had wanted (and it wouldn't have actually changed anything): – Sasha Chedygov Oct 18 '09 at 19:40
Anyway, +1, good description. – Sasha Chedygov Oct 18 '09 at 19:41

The file is a default as defined in the web servers config, or it's using URL re-writing (the folder path might not even exist).

share|improve this answer
Oops... forgot to address the domain name only question... This can be done by using a frameset, and only having the content's frame shown. – AbsCoder Oct 17 '09 at 23:22
You can edit your answer instead of writing a comment. – Sasha Chedygov Oct 18 '09 at 19:39
IIRC, a person with a reputation of 1 can't edit his own posts. – CarlF Oct 18 '09 at 21:52
There, he can edit! Abs, would you mind editing your answer to include the comment? – Josh Hunt Oct 21 '09 at 1:55

What I was really looking for, is this: Just create a directory, have index.php/html inside the folder, and links to that directory won't show the file. Thanks for the other things too.

share|improve this answer
That's really more of a hack...url rewriting or content pointers are more commonly how it's accomplished – Chris Thompson Oct 20 '09 at 23:28

You must log in to answer this question.

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