IIS7.0通过web.config重定向怎样弄?
|
|
我用的是IIS7.0的空间,domain.com和bbs.domain.com绑定在同一个空间的同一个目录,所以现在访问domain.com和bbs.domain.com是同一个站。
网站根目录下有一个论坛bbs,怎样将bbs.domain.com重定向到www.domain.com/bbs?
要通过web.config来实现,不知道代码该怎么写。下面这样的代码我试过,不行,高手帮忙看下哪里有问题:- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="BBS Redirect" stopProcessing="true">
- <match url=".*" />
- <conditions>
- <add input="{HTTP_HOST}" pattern="^bbs.domain.com$" />
- </conditions>
- <action type="Redirect" url="http://www.domain.com/bbs/{R:1}" redirectType="Permanent" />
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
复制代码
[ 本帖最后由 microsoft 于 2010-10-14 08:30 PM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
goldstein
发表于 2010-10-15 10:45:39
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
fxin
发表于 2011-1-26 22:15:48
|
显示全部楼层
代码是这样写的
你的代码写错了,IIS7.0的web.config应该这样写的!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
<rewrite>
<rules>
<rule name="bbs Redirect" stopProcessing="true">
<match url="bbs/.*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^bbs.123.com$" />
</conditions>
<action type="Redirect" url="http://www.123.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration> |
评分
-
查看全部评分
|
|
|
|
|
|
|
|
|
|
muxia
发表于 2011-2-19 14:44:18
|
显示全部楼层
|
|
|
|
|
|
|
|