在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
论坛里有很多关于去掉index.php的教程和代码,但是悲剧的是都是自己能配置服务器, XML复制代码
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <directoryBrowse enabled="false" /> <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> <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> <error statusCode="500" subStatusCode="1" prefixLanguageFilePath=""path="www.QFisH.net" responseMode="ExecuteURL" /> <error statusCode="404" subStatusCode="1" prefixLanguageFilePath="" path="qfish.me"responseMode="Redirect" /> </httpErrors> </system.webServer> </configuration>
如果只是需要去掉index.php, 那直接把下面这段代码加到 <system.webServer> </system.webServer>中间就可以了。 XML复制代码
<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>
PHP复制代码
// $config['index_page'] = "index.php"; 把其中的 "index.php" 改成 "" ,如下: $config['index_page'] = "";
|
2022-08-18
2022-08-17
2022-08-15
2022-11-06
2022-08-17
请发表评论