Custom Routes to File

Hi,

I was going through the Routes Docs, but couldn’t find a way to route a specific url to a file. Similar to this concept :

$routes->connect(
    '/government',
    ['controller' => 'Pages', 'action' => 'display', 5]
);

But looking for something like this :

// Accessing /government/file.txt will serve the file from webroot/specialFiles/file.txt
$routes->connect(
    '/government/*',
    ['folder' => 'specialFiles', ]
);

This is a job for your .htaccess file, not Cake.

i know there are several options, such routing can be done using the web service (nginx, apache) or writing a php-script in the middleware-controller. But it would be nice to have such feature in cake route too, so it is more ‘portable’.