dannyvankooten / PHP-Router

Simple PHP Router class (supports REST and reverse routing)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

404 errors in event log not showing

opened this issue · comments

When on the page have resources with status 404 (not loading or is gone), the event log in browser doesn't show any output for this resources.
I thing the PHP-Router is the problem.
How to fix this ?

edit:
My htaccess is:

#Router
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

As mentionned into your .htaccess file, all query on non-existents ressources (files and directories) are redirected to index.php

When you use PHPRouter you must define your own 404 page by testing the result of PHPRouter\Router::matchCurrentRequest().

Here is an example:

$router = new Router($collection);
$route = $router->matchCurrentRequest();

// If we have no route matched
if(!$route) {
   // display 404 error
}