You can use url rewrite to append the extension when one is not specified. OR you could build a routing system to link specific uri to a specific resource (quick example here). The latter introduces a lot of complexity but gives much more control. For example, here is basic pseudo code based on a custom routing system I built:
$routes->addStaticRoute(
/* Pattern */ '/home/myPage',
/* Params */ null,
/* File */ 'path/to/myPage.php'
);
All requests automatically go to index.php where my router translates the url request into an actual routes to a resource. With the above static route, if a user requests http://mySite/home/myPage
, the router will respond with the static file at path wwwroot/path/to/myPage.php
.
Another example of a static route:
$routes->addStaticRoute(
/* Pattern */ '/home/{fileName}.{extension}',
/* Params */ ['fileName' => 'index', 'extension' => 'php'],
/* File */ 'path/to/{fileName}.{extension}'
);
If a user requests http://mySite/home
the router will respond with the default wwwroot/path/to/index.php
. Further, if they request http://mySite/home/page5
, router will respond with (if exists) wwwroot/path/to/page5.php
.
Routing is somewhat of an advanced concept and these are some oversimplified examples but I hope this gets you started.