Filter to custom error pages - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Filter to custom error pages (/showthread.php?tid=80967) |
Filter to custom error pages - BilltheCat - 01-09-2022 I'm using a simple honeypot filter, and I can't seem to display the error page correctly. Can anyone see something wrong with what I'm doing here? Instead of the expected "Not allowed" message, I'm seeing a default message like: Quote:This page isn’t working Here's what I'm doing.... #1 app/Filters/MyhoneypotFilter.php: PHP Code: <?php #2 I won't include everything in my htaccess, but if it matters, I'll add it. mysite/public_html/.htaccess: Code: ErrorDocument 405 /error.php #3 mysite/public_html/error.php: PHP Code: <?php RE: Filter to custom error pages - iRedds - 01-09-2022 You are expecting a message, but you are not sending it. Therefore, you get the default message. PHP Code: return Services::response()->setStatusCode(405)->setBody('Not allowed'); RE: Filter to custom error pages - BilltheCat - 01-10-2022 Thanks, That gets me the message string, but it doesn't push out to my error.php file. If I'm using the CI framework, can I not use an external file to grab the REDIRECT_STATUS key/value? RE: Filter to custom error pages - BilltheCat - 01-11-2022 Never mind on this.... I think I'm making things harder than they need to be, and it's not worth the effort. I'm just going to throw ConfigException. |