为什么星号返回页面被禁止? [英] Why does an asterisk return a forbidden page?
问题描述
我使用XAMPP与Apache / 2.4.0和PHP / 5.6.3,我已经注意到,一个星号(*)作为在URL中第一个字符像的http://本地主机/ *
引起的apache运行PHP之前返回禁止访问页面。我还没有发现任何其他网站利用任何东西的星号,所以我知道这一定是某种原因或其他无效字符,但我无法找到任何东西。有谁知道如何重写这XAMPP这样我就可以在PHP中做我自己的自定义错误管理?
I'm using XAMPP with Apache/2.4.0 and PHP/5.6.3 and I've noticed that an asterisk (*) as the first character in a URL like http://localhost/*
causes apache to return an access forbidden page before running PHP. I haven't noticed any other websites making use of the asterisk character for anything so I know it must be an invalid character for some reason or another but I can't find anything on it. Does anybody know how to override this in xampp so I can do my own custom error management in PHP?
推荐答案
要自定义错误页:
To customize your errors pages :
编辑文件的的conf /额外/的httpd-multilang-errordoc.conf
更新包含行的ErrorDocument 403 ,你有3个型动物味:
的ErrorDocument 403/error/myCustom403ErrorPage.html
的ErrorDocument 403http://en.wikipedia.org/wiki/HTTP_403
Edit the file conf/extra/httpd-multilang-errordoc.conf
Update the line that contains ErrorDocument 403, you have 3 differents flavor :
ErrorDocument 403 "What are you doing here ??"
ErrorDocument 403 "/error/myCustom403ErrorPage.html"
ErrorDocument 403 "http://en.wikipedia.org/wiki/HTTP_403"
注意:您必须* .conf文件更新
后重新启动Apache服务器
星号是一个保留字符,它是Apache使用这个原因:
在有多个用户的系统,每个用户都可以被允许使用UserDir指令的有一个网站在他们的家目录
你可以阅读来自Apache本文档中星号是什么知道的是真正使用:) 阿帕奇 - 每用户的网络目录
Note: You must restart Apache server after *.conf update
The asterisk is a reserved character, it is used by Apache for this reason :
"On systems with multiple users, each user can be permitted to have a web site in their home directory using the UserDir directive"
You can read This documentation from Apache to know in what asterisk is really used :) Apache - Per-user web directories
更新:
如果你想执行一个PHP脚本作为错误页面(你可以用香精3)
UPDATE:
If you want to execute a php script as error page (you can use flavor 3)
ErrorDocument 403 "http://localhost/customWebAppError/error403.php"
更新
的ErrorDocument 403 /error/ERROR_403.html
ErrorDocument 403 /error/ERROR_403.html
这篇关于为什么星号返回页面被禁止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!