Search code examples
phphtml.htaccesshttp-status-code-404http-status-code-500

Custom 404 and 500 errors not working


Got custom 404 and 500 error pages which don't work. I'm given the following error for both pages, when trying to access directly or via error: error img


.htaccess content:

DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

ErrorDocument 404 /error_docs/404.php
ErrorDocument 500 /error_docs/500.php

error pages both contain:

<p>text</p>

I've checked both paths several times and they are correct. If i substitute the file paths for text, the text is displayed and the error works. Thanks.


Solution

  • Remove this line and finally you are ready

    RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]