下面是我的web.config,我的问题是当访问www.domain.com它将转发到www.domain.com/index.php, 但一些将留在www.domain.com(没有index.php)
我如何确保用户访问使用index.php它将redirect到/?
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <directoryBrowse enabled="true" /> <defaultDocument> <files> <clear /> <add value="index.php" /> <add value="Default.htm" /> <add value="Default.asp" /> <add value="index.htm" /> <add value="Default.aspx" /> </files> </defaultDocument> <httpErrors> <remove statusCode="403" subStatusCode="-1" /> <error statusCode="403" prefixLanguageFilePath="" path="https://www.domain.com" responseMode="Redirect" /> </httpErrors> </system.webServer> </configuration>
如果您希望将索引文档重写为URI中path的基础,请执行以下操作:
–
<rule name="Default document rewrite" stopProcessing="true"> <match url="(.*)index.php" /> <action type="Redirect" url="{R:1}" redirectType="Permanent" /> </rule>