Home > php教程 > php手册 > body text

hp在IIS下和apache下urlrewrite返回不同的REQUEST_URI解决办法

WBOY
Release: 2016-05-25 16:52:16
Original
1193 people have browsed it

php在windows IIS平台运作的时候,有些东西和在Linux apache下不太一样,今天遇到个神奇的问题,就是用 $URI=$_SERVER["REQUEST_URI"];

在linux下看到的是urlrewrite静态化以后的地址 /exy/exk/list-3/,windows下返回的是原来的地址 /exy/article.php?page=3

这时候发现windows下有个办法HTTP_X_REWRITE_URL,这个数组,linux下没有,所以代码小修改下以兼容两个平台。(更换服务器真是各种水土不服),代码如下:

if($URI==null){ 
    $URI=$_SERVER["REQUEST_URI"]; 
} 
//print_r($_SERVER); 
echo $URI;
Copy after login

这样就两个平台都能正确的显示了。

教程链接:

随意转载~但请保留教程地址★

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template