The error log of my CakePHP app is full of 404 errors. Can I exclude these MissingControllerException
s from appearing in the error log? Using Cake 2.3.
The simplest and easiest way to fix your 404 error code is to redirect the page to another one. You can perform this task using a 301 redirect. What's 301, you may ask? It's a redirect response code that signals a browser that the content has been transferred to another URL.
By keeping a log of 404 errors, not only will you improve your website's user experience, but you'll also be able to: Quickly identify and fix broken links. Improve your website's search engine performance (SEO). Better identify suspicious behaviour such as “fuzzer” scans or website infections.
A 404 error message is a Hypertext Transfer Protocol (HTTP) status code indicating the server could not find the requested website. In other words, your web browser can connect with the server, but the specific page you're trying to access can't be reached.
Best Practices for Redirecting 404 Pages404s should not be redirected globally to the home page. 404s should only be redirected to a category or parent page if that's the most relevant user experience available. It's okay to serve a 404 when the page doesn't exist anymore (crazy, I know).
versions above 2.4 (as mentioned by null) have an undocumented feature for this purpose.
just modify your exception config:
Configure::write('Exception', array(
'handler' => 'ErrorHandler::handleException',
'renderer' => 'ExceptionRenderer',
'log' => true,
'skipLog'=>array(
'MissingControllerException'
)
));
skipLog takes names of exception classes to be excluded from log.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With