tp5 iis服务器伪静态配置
用了一个虚拟空间,服务商一直配置不对,百度了一下参考这个配置
参考了这个配置
<?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" /> <security> <requestFiltering allowDoubleEscaping="True" /> </security> <defaultDocument> <files> <clear /> <add value="index.php" /> <add value="Default.htm" /> <add value="Default.asp" /> <add value="index.htm" /> <add value="index.html" /> <add value="iisstart.htm" /> </files> </defaultDocument> </system.webServer> </configuration>
发现服务器提示没有权限
查看一下,服务商给我配置的没有效果的伪静态
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <remove name="AboMapperCustom-13496" /> <add name="php5.5" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php5.5\php-cgi.exe" resourceType="Unspecified" /> </handlers> <httpErrors errorMode="Detailed" /> <rewrite> <rules> <rule name="已导入的规则 1-1" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php?/{R:1}" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
最后组装一下,解决问题
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <remove name="AboMapperCustom-13496" /> <add name="php5.5" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php5.5\php-cgi.exe" resourceType="Unspecified" /> </handlers> <httpErrors errorMode="Detailed" /> <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> </system.webServer> </configuration>