IT备忘录

您现在的位置是:首页 > 运维 > Windows

Windows

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

2022-04-04 15:27:52Windows
对于Windows server服务器上使用IIS架设网站的网站长,可能都遇到过访问首页会自动在网址后面加上index.php,那么我们如何使IIS服务器隐藏index.php,首页文件呢?下面IT备忘录小编

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

方法步骤:

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>

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

相关内容标签

文章评论