Web server Routing

Browsers use the HTTP protocol to communicate with a web server. The server responds with an HTML page.

  • πŸ‘‰ If there is no routing, the URL is associated with a local path on the server, and the file is loaded if present.
URL: http://localhost/example/file.html
Possible path resolved: /var/www/example/file.html
  • πŸ‘‰ If there is no file in the URL, web servers may load index.html/index.php/... if present.
URL: http://localhost/example/
Possible path resolved: /var/www/example/index.html
  • πŸ‘‰ Modern apps are usually using a router. This reduces securities issues. Every URL will be redirected to a routing file which will determine which HTML page should be returned.
URL: http://localhost/example/
Request send to: some_router.php 
Possible path resolved: /var/www/file.html