为什么星号返回页面被禁止? [英] Why does an asterisk return a forbidden page?

查看:124
本文介绍了为什么星号返回页面被禁止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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个型动物味:

  • 香精1,纯文本:                <$c$c>ErrorDocument 403你在这里做什么?

  • 香精2,本地重定向:&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; 的ErrorDocument 403/error/myCustom403ErrorPage.html

  • 香精3,外部重定向的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 :

  • Flavor 1, plain text:                ErrorDocument 403 "What are you doing here ??"
  • Flavor 2, local redirects:       ErrorDocument 403 "/error/myCustom403ErrorPage.html"
  • Flavor 3, external redirects: 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"
    



    更新


  • 创建您的自定义错误页的 ERROR_403.html

  • 把它在 XAMPP /阿帕奇/错误

  • 更新的httpd-multilang-errordoc.conf 的ErrorDocument 403 /error/ERROR_403.html

  • 创建一个 IFRAME AJAX 内在要求您的 ERROR_403.html 可与您的服务器进行通信,并提供定制响应
  • Create your custom error page ERROR_403.html
  • Put it under xampp/apache/error
  • Update httpd-multilang-errordoc.conf by ErrorDocument 403 /error/ERROR_403.html
  • Create an iframe or an ajax request inside your ERROR_403.html that can communicates with your server and deliver custom response
  • 这篇关于为什么星号返回页面被禁止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆