如何在 codeigniter 中设置 403 错误自定义 html 页面

How to set up 403 error custom html page in codeigniter

我已经限制了直接 URL 的图像和 pdf 就像如果有人直接输入图像 url http://localhost/project/images/home.PNG 然后它将在 403 页面上重定向,但我想为这个错误设置新的 html 就像 404 那么我该怎么做

RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost/project [NC] 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost/project.*$ [NC] 
RewriteRule \.(jpg|pdf|png|gif|PNG)$ - [F]

这是我如何限制文件夹中的图像请建议我如何为 403 错误显示自定义 html。

在您的 Applications/errors 文件夹中使用您的自定义 UI

创建一个 error_403.php

只需编辑 Applications/errors 文件夹中的 index.php 文件