今天写了以下站点。然后觉得比较麻烦。重新写了下。
在站点的根目录 web.config 这个文件中添加
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Urlpath" enabled="true" stopProcessing="true"> <match url="([^/]*(.*))" ignoreCase="true" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^([a-zA-Z|0-9]+)\.jlasp\.com$" /> </conditions> <action type="Rewrite" url="/Demo/{C:1}/{R:0}" appendQueryString="false" logRewrittenUrl="false" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
然后访问 zhanzhang.jlasp.com
实际上是:jlasp.com/demo/zhanzhang/
吉公网安备 22020202000301号