Will
Will

Reputation: 4715

cakephp 3 Routes match /*.php

I'd like to capture all the attempted hacks and just send them to a page. How can I do that with routes?

I can do this:

  $routes->connect('/pma/*',   $hacks);

Which works for

eg /pma/whatever

... but for just routes like

/cmd.php 

I've tried like this:

$hacks = ['controller' => 'hacks', 'action' => 'display'];
$routes->connect('/*.php',   $hacks);

Which doesn't work, the * doesn't match if it is the first element.

Upvotes: 0

Views: 41

Answers (1)

Timur Asaliev
Timur Asaliev

Reputation: 74

You can use a pattern:

$routes
    ->connect('/:withPhpExt', $hacks)
    ->setPatterns(['withPhpExt' => '.*\.php']);

Upvotes: 1

Related Questions