Webpage Requests

Created by josh
October 17, 2020 1:28:04 PM PDT (Revised October 17, 2020 1:30:14 PM PDT )

Requesting a webpage - how it works under the hood

When a web address request is made to Gaseous, all requests are funneled through the top-level index.php file. This file checks the URI Redirect table to check if this URI is supposed to redirect elsewhere (either somewhere else on the site, or a different URL entirely). Next, it attempts to match with entries in the URI Routes table, where regex patterns point to different controllers within the app. These patterns range in simplicity and the order of which route to match first will determine priority in various patterns.


A simple route pattern looks like /robots.txt and maps to the PHP file controllers/services/robots.txt.php.  A more complicated route, which is a catch-all pattern (presumably attempting to match pages generated via dynamic CMS content), looks like ([\w\/\-]+)/? and maps to the controller controllers/cms/index.php?page=$1.


The controller, of which a request URI is mapped to, generally invokes the Templator and necessary libraries via the autoloader to produce the page required.