You could see if the request uri begins with the string '/categories/':
<?php
$request_uri = '/categories/foo';
if (strpos($request_uri, '/categories/') === 0 )
{
include 'your.html';
}
Substitute the value of $request_uri above with $_SERVER['request_uri']
. Under the assumption that you have this logic in a front controller.
Further:
<?php
$request_uris = [
'/categories/foo',
'/categories/',
'/categories',
'/bar'
];
function is_category_path($request_uri) {
$match = false;
if (strpos($request_uri, '/categories/') === 0 )
{
$match = true;
}
return $match;
}
foreach ($request_uris as $request_uri) {
printf(
"%s does%s match a category path.\n",
$request_uri,
is_category_path($request_uri) ? '' : ' not'
);
}
Output:
/categories/foo does match a category path.
/categories/ does match a category path.
/categories does not match a category path.
/bar does not match a category path.
In use:
if(is_category_path($_SERVER['REQUEST_URI'])) {
include 'your.html';
exit;
}
You may want to not match the exact string '/categories/', if so you could adjust the conditional:
if(
strpos($request_uri, '/categories/') === 0
&& $request_uri !== '/categories/'
) {}