【问题标题】:Can't access URL link on Apache in CentOS7在 CentOS7 中无法访问 Apache 上的 URL 链接
【发布时间】:2019-09-16 01:40:16
【问题描述】:

我有一个在 CentOS 7.0 上使用 PHP、httpd (Apache 2) 和 mod_security 的系统。这个应用不是我编程的,我只是操作和维护的。

我办公室中的某些 PC 无法访问 Web 应用程序 URL。

这里是网址:

This is origin URL,此链接中有两个字符“//”:

url中有两个“//”字符,一些PC无法访问。

如果我从“//”更改为“/”,则访问成功。

我想从“//”自动更改为“/”。

【问题讨论】:

    标签: php apache centos httpd.conf mod-security


    【解决方案1】:

    我也是越南人。

    <?php
    
    $uri = $_SERVER['REQUEST_URI'];
    
    if (strpos($uri, '//') !== false) {
        $uri = str_replace('//', '/', $uri);
    
        header("Location: $uri");
    }
    

    这是变化:

    BEFORE: http://127.0.0.1/test.php//?&mod=server
    AFTER: http://127.0.0.1/test.php/?&mod=server
    

    【讨论】:

      猜你喜欢
      • 2018-09-19
      • 1970-01-01
      • 1970-01-01
      • 2023-04-11
      • 2013-10-02
      • 2020-12-11
      • 2015-09-08
      • 1970-01-01
      • 2012-01-26
      相关资源
      最近更新 更多