您的位置:首页 > 编程语言 > PHP开发

西部数码虚拟主机iis怎么路由重写,去除隐藏index.php

2017-08-19 14:34 736 查看
按道理说西部数码里面有一个伪静态选项, 我们通常配置的时候是用.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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: