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

问题描述 投票:2回答:1

我已经限制了直接网址中的图片和pdf,例如,如果有人输入图片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。

php html codeigniter http-status-code-403
1个回答
1
投票

Applications/errors文件夹中,使用自定义UI创建error_403.php

OR

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

© www.soinside.com 2019 - 2024. All rights reserved.