Core Boxx – Route Library Reference


  • This library requires Apache mod_rewrite to work properly.
  • Although you can always “translate” the .htaccess file for IIS and NGINX.



function run()

Reads the current URL and determines if it is an API call or request for an HTML page. Loads the requested file.

  • Sets define("API_MODE", 1) if it is*. Calls api().
  • Otherwise sets define("WEB_MODE", 1) if it is*. Calls resolve().
function init()

Regenerates .htaccess and CB-manifest.json. The URL rewrite is “borrowed” from WordPress. If you have to support IIS or NGINX, feel free to add your own “translated .htaccess“.




function resolve()

Resolve URL path to HTML page. Add your own manual route overrides in lib/CORE-Routes.php

  • $override Has the highest priority.
  • $routes Exact matches have the next highest priority.
  • $wild Followed by wildcards.
  • Lastly, fallback to map to pages/PAGE-PATH.php.
function load($file, $http)

A “helper function” for resolve(). You can also use this in your pages to load the given HTML page.

  • $file – String, file to load.
  • $http – Integer, optional HTTP response code.
$_CORE->Route->load("NO-ACCESS.PHP", 403);



function api()

Reads the current URL path and maps it to lib/API-MODULE.php.

Leave a Comment

Your email address will not be published. Required fields are marked *