对于Windows server服务器上使用IIS架设网站的网站长,可能都遇到过访问首页会自动在网址后面加上index.php,那么我们如何使IIS服务器隐藏index.php,首页文件呢?下面小编就给大家分享一个解决方法给大家,希望能帮到各位网站长。
1、先下载安装微软的URL Rewrite模块
网址:https://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads
安装完成后iis会出现url重写模块
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首页文件的方法,如果您觉得此方法好,请转载分享!
正在阅读:
房产中介工作计划书06-15
2021上半年江苏科技大学英语四六级考试报名工作通知【3月24日-4月6日】09-19
母亲的微笑作文600字09-07
十二岁我想作文800字12-12
叶店文化礼堂一日游作文400字10-09
我的苦恼作文350字09-05
兰草作文700字11-11
我的心儿怦怦跳参加班干部竞选06-18