【问题标题】: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