win服务器下 子目录 子站 伪静态方法分享
已完成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/ 改成你当前子目录名称。
以上,用得着的朋友,帮回帖支持下。


回帖 ( 0 )