我正在使用http://urlrewriter.net/站点提供的 URL 重写器模块。谁能告诉我如何使用他们的模块将 www.example.com 重定向到 example.com(301 重定向)。
Prashant
问问题
1058 次
4 回答
4
如果您只想重定向www.example.com
:
<if header="HTTP_HOST" match="www.example.com">
<redirect url=".*" to="http://example.com$0" permanent="true" />
</if>
如果您想将所有内容重定向example.com
到example.com
:
<unless header="HTTP_HOST" match="example.com">
<redirect url=".*" to="http://example.com$0" permanent="true" />
</unless>
于 2009-02-28T19:28:20.523 回答
1
<redirect url="http://www.example.com/(.+)$" to="http://example.com/$1">
于 2009-02-28T19:20:09.547 回答
1
重复的内容将无 www 重定向到 www asp.net
<if header="HTTP_HOST" match="^domain.com" url="/default.aspx$">
<redirect to="http://www.domain.com/" />
</if>
<if header="HTTP_HOST" match="^domain.com" url="~/(.+)$">
<redirect to="http://www.domain.com/$1" />
</if>
我测试了这段代码及其正确性
于 2011-06-24T14:12:18.247 回答
0
我从来没有使用过 urlrewriter,但看起来你会使用以下(或类似的东西:
<redirect url="^(.+)$" to="http://example.com/$1" permanent="true" />
在 www.example.com 网站上。
于 2009-02-28T19:20:07.097 回答