Reputation: 123
Sites like Minneapolis' Metro transit have URLs defined by variables chosen by the user, e.g.:
http://svc.metrotransit.org/NexTrip/5/4/MAAM?format=json
In this instance 5 is a route number and 4 is a direction enum. On the server there are not actually files titled 5 and 4. How would a server interpret those as variables for the NexTrip page? Why is it not something like:
http://svc.metrotransit.org/NexTrip.html?route=5&direction=4......?
What is this concept called? I understand this is a very basic question but not knowing makes it impossible to search. In general what is happening behind the scenes here? Please note - I understand this is an API but regular sites use this concept as well, this was just an example. Any help or direction is appreciated.
Upvotes: 1
Views: 71
Reputation: 1234
URLs have nothing to do with files specifically, although URLs can sometimes display where a file is stored within the directory of a web server. There is something called URL Rewriting, see HERE, that can rewrite the URL so that it looks better, or is easier to remember, or perform another function for whatever other reason the developer may have set it up for.
See HERE for .htaccess URL ReWrite or HERE for .config URL ReWrite.
Upvotes: 3