web.config求救。如何根据这个规则写出一个新的规则
web.config求救。如何根据这个规则写出一个新的规则
以下代码是万网主机提供的,放在web.config文件中的
---------------------------------------------------------------
<?xml version="1.0"?>
<configuration>
.....
<rewriter>
<rewrite url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js)(\?.+)?)$" to="$1" processing="stop" />
<rewrite url="~/lmh$" to="~/testurl/Users.aspx?user=lmh" processing="stop" />
<rewrite url="~/tags/(.+)" to="~/testurl/tagcloud.aspx?tag=$1" processing="stop"/>
<rewrite url="~/article-([^-]+)-([^-]+)-([^-]+).html" to="~/testurl/article.asp?id=$1&sid=$2&page=$3" processing="stop"/>
<rewrite url="^~/mypage(\?.+)?$" to="~/index.htm$1" processing="stop" />
</rewriter>
</configuration>
---------------------------------------------------------------
上面乱七八糟的规则 都不是我要的
现在要在<rewriter>节点中,增加一条<rewrite>,完成如下的功能:
用户访问http://a.com/x.html 会跳转到htt://www.a.com/x.html
也就是访问不带www的,跳转到带有www的 相对应的网址
该怎么写啊?
请教各位了
以下代码是万网主机提供的,放在web.config文件中的
---------------------------------------------------------------
<?xml version="1.0"?>
<configuration>
.....
<rewriter>
<rewrite url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js)(\?.+)?)$" to="$1" processing="stop" />
<rewrite url="~/lmh$" to="~/testurl/Users.aspx?user=lmh" processing="stop" />
<rewrite url="~/tags/(.+)" to="~/testurl/tagcloud.aspx?tag=$1" processing="stop"/>
<rewrite url="~/article-([^-]+)-([^-]+)-([^-]+).html" to="~/testurl/article.asp?id=$1&sid=$2&page=$3" processing="stop"/>
<rewrite url="^~/mypage(\?.+)?$" to="~/index.htm$1" processing="stop" />
</rewriter>
</configuration>
---------------------------------------------------------------
上面乱七八糟的规则 都不是我要的
现在要在<rewriter>节点中,增加一条<rewrite>,完成如下的功能:
用户访问http://a.com/x.html 会跳转到htt://www.a.com/x.html
也就是访问不带www的,跳转到带有www的 相对应的网址
该怎么写啊?
请教各位了
...全文
相关推荐
IIS7伪静态web.config配置的方法和规则
本文主要介绍IIS7上配置伪静态的超简单的新方法,安装URLRewrite插件,配置web.config即可。
web.config文件配置详解
很多asp.net项目中必须web.config文件,但是如果对它不熟悉的话也会带来很多麻烦。近日,看到博客园技术前辈总结的文章很不错,推荐给大家,以便在今后的开发中少走弯路。
Web.config 和 App.config 的区别分析
Web.config 和 App.config 的区别分析,需要的朋友可以参考一下
Web.config配置详解
帮助理解Web.config,有助于在Web.config配置一些正确的参数。
url重写web.config文件
url重写web.config文件url重写web.config文件


