歡迎來(lái)到奇迪科技(深圳)有限公司,超值服務(wù)提供卓越產(chǎn)品!
本地IIS7.5實(shí)現偽靜態(tài)_網(wǎng)絡(luò )編程_奇迪科技(深圳)有限公司(m.cheanjie.com)
在網(wǎng)站制作、本地測試的時(shí)候,有時(shí)候可能需要用到本地偽靜態(tài)設置,以下的方法能夠讓本地的IIS支持設置wordpress、CMS等偽靜態(tài)。
把以下的代碼保存為web.config文件:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="category"> <match url="category/?(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="/index.php?category_name={R:1}" appendQueryString="false" logRewrittenUrl="false" /> </rule> <rule name="tags"> <match url="tag/?(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="index.php?tag={R:1}" /> </rule> <rule name="Main Rule" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:0}" /> </rule> <rule name="wordpress" patternSyntax="Wildcard"> <match url="*" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule></rules> </rewrite> </system.webServer> </configuration>
還需要一個(gè)前提條件,那就是IIS7.5需要先安裝 URL重寫(xiě)組件。
本文版權所有,轉載須注明:來(lái)源 http://m.cheanjie.com/qvdv-oop-162.html