业务经理

微信扫描以上二维码

028-61286886

技术咨询

win服务器下 子目录 子站 伪静态方法分享

迅睿框架 更新 2023-02-10 11:49:52 Swlts


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/ 改成你当前子目录名称。 


以上,用得着的朋友,帮回帖支持下。

方案

  • 眼镜 #1 · 2022-08-04 15:25:01
    收藏了,刚好要用
  • perweb #2 · 2023-02-10 11:49:52
    这个绑定目录的可以,绑定二级域名,没有生效

迅睿系统漏洞

独立站群系统
独立站群系统(2026-09-14)
子站独立部署时修复同步附件失败问题
在线客服
在线客服(2026-09-13)
修复删除会话报错问题 删除会话时联动删除聊天图片
在线考试竞赛系统
在线考试竞赛系统(2026-09-12)
增加投票功能 考试功能拓展 注意:更新后需要执行系统更新,更新数...
网上信箱
网上信箱(2026-09-12)
修复新版本兼容问题
GeoSeo收录宝
GeoSeo收录宝(2026-09-12)
1 优化Update.php文件,解决版本在线升级不完整问题 2 ...
GeoSeo工具箱
GeoSeo工具箱(2026-09-11)
修正历史记录推送
微信系统
微信系统(2026-09-11)
增加数据统计总览界面 账号管理增加服务和公众号的区别 菜单管理支持更...
答题系统
答题系统(2026-09-11)
一站式在线答题系统,支持真题考试、题库练习和错题本,适合培训、考证、...
阿里云滑动验证码
阿里云滑动验证码(2026-09-10)
采用阿里云验证码替换迅睿系统自带的图片验证码和滑动验证码。后台设置方...
下载Plus
下载Plus(2026-09-09)
为网站附件下载加上“计数、限次、统计、防护”四重能力:按用户组控制下...