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

时间:2015-02-05 07:10:03

标签: php html codeigniter http-status-code-403

我已经限制了图片和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。

1 个答案:

答案 0 :(得分:1)

在你的"应用程序/错误"文件夹创建" error_403.php"使用您的自定义用户界面

OR

只需编辑"应用程序/错误"中的index.php文件。夹