聯系官方銷售客服
1835022288
028-61286886
win服務器下 子目錄 子站偽靜態辦法分享。 原理很簡單,分享給大家。就是用location 標簽 區分 主站和子目錄的重寫規則 web.config
雖然目前Linux用戶很多,win服務器也有很多用戶使用。
根目錄下的 web.config
<?xml version="1.0" encoding="UTF-8"?> <configuration> <location path="." allowOverride="false" inheritInChildApplications="false"> <system.webServer> <rewrite> <rules> <rule name="已導入的規則 1" stopProcessing="true"> <match url=".(js|ico|gif|jpe?g|bmp|png|css)$" negate="true" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="/index.php" /> </rule> </rules> </rewrite> </system.webServer> </location> </configuration>
子目錄下的 web.config
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="已導入的規則2" stopProcessing="true"> <match url=".(js|ico|gif|jpe?g|bmp|png|css)$" negate="true" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="/en/index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
其中/en/ 改成你當前子目錄名稱。
以上,用得著的朋友,幫回帖支持下。