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.
删除此行,最后您准备好了
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
As an example in XAMPP whe you use it redirects to the localhost folder. 它将重定向到localhost文件夹。 If I write:
ErrorDocument 404 /error_docs/404.php
It redirects to:
localhost/error_docs/404.php
In fact the ErrorDocument always redirects to the DocumentRoot
So the best way (I know right now) to do it is with an absolute path
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.