西部数码虚拟主机iis怎么路由重写,去除隐藏index.php
程序员文章站
2024-03-26 13:50:41
...
按道理说西部数码里面有一个伪静态选项, 我们通常配置的时候是用.htaccess 来隐藏index.php 有一个客户用的是西部数码的,折腾了很久就是不能成功
我们点击伪静态设置,选择 shopex 然后wwwroot 目录回生成一个web.config文件,编辑其文件下面的代码覆盖她
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<clear />
<add value="index.asp" />
<add value="index.aspx" />
<add value="index.php" />
<add value="index.html" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="Default.aspx" />
<add value="index.shtml" />
</files>
</defaultDocument>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/404.html" responseMode="ExecuteURL" />
</httpErrors>
<security>
<requestFiltering allowDoubleEscaping="true"></requestFiltering>
</security>
</system.webServer>
</configuration>
这样就隐藏了index.php