Home » Questions » Computers [ Ask a new question ]

Website URL hiding/hiding file

Website URL hiding/hiding file

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

Asked by: Guest | Views: 47
Total answers/comments: 2
Guest [Entry]

"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 example.com/blog/2009/oct/18/what-have-we-come-to. 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 example.com/blog/articles.php?id=423. 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 example.com/blog/2009/oct/18/what-have-we-come-to.

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:

'superuser.com/' > displayFrontPage()
'superuser.com/questions/' > displayQuestionsList(sorted=default)
'superuser.com/questions/<QuestionID>/<QuestionID>' > displayQuestion(question= QuestionID)

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

superuser/
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"
Guest [Entry]

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.