IIS 服务器隐藏 index.php 的方法

时间:2022-05-29 00:08:01 阅读: 最新文章 文档下载
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

对于Windows server服务器上使用IIS架设网站的网站长,可能都遇到过访问首页会自动在网址后面加上index.php,那么我们如何使IIS服务器隐藏index.php,首页文件呢?下面小编就给大家分享一个解决方法给大家,希望能帮到各位网站长。

方法步骤:

1、先下载安装微软的URL Rewrite模块

网址:https://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads

安装完成后iis会出现url重写模块

IIS 服务器隐藏 index.php 的方法

2、在项目网站根目录下创建web.config文件  写入以下代码即可

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WPurls" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

以上就是小编给各位网站长分享的IIS隐藏Index.php首页文件的方法,如果您觉得此方法好,请转载分享!

本文来源:https://www.wddqw.com/QaHh.html