弘帝企业智能建站系统交流平台

 找回密码
 立即注册
查看: 794|回复: 0

【IIS】用URLWrite实现二级域名绑定子目录

[复制链接]
发表于 2022-8-15 16:13:20 | 显示全部楼层 |阅读模式
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="url.console remove dir.console" stopProcessing="true">3
                实现:http://console.cloud/实现上执行路径为http://console.cloud/console/default.aspx
                说明:在地址栏录入console.cloud的时候,将路径转换为^([^/]*)/?$,执行console/default.aspx内容,得到
                使用入站规则,R1为?后值
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^(console.cloud)$" />
                    </conditions>
                    <match url="^([^/]*)/?$" />
                    <action type="Rewrite" url="console/default.aspx?{R:1}" />
                </rule>
                 实现:http://cloud/console时,实现自动跳转到http://console.cloud
                说明:在地址栏录入cloud,且子目录为console的时候,自动转向到console.cloud域名
                仍然使用入站规则
                 <rule name="url.cloud/console -> console.cloud" stopProcessing="true">
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <match url="^console/default.aspx?(.*)$" ignoreCase="false" />
                    <action type="Redirect" url="http://console.cloud/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>

真实案例:Hondy.Cloud.WebConfig,但仍然有很多问题,比如样式丢失,需进一步研究,以上未用到反向代理。



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|弘帝企业智能建站系统 ( 皖ICP备07503252号 )

GMT+8, 2024-5-19 06:15 , Processed in 0.079188 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表