IIS URL Rewrite – Installation and Use
2013-11-08 13:25
471 查看
IIS URL Rewrite – Installation and Use
Posted by Nick LeFevre | Leave a replyIIS URL Rewrite Installation
To get the below URL Rewrite code to work in IIS, you must first install the URL Rewrite module. The URL Rewrite module is not installed by default. The IIS URL Rewrite module may be a better solution than HTTP Redirect in IIS. You can effectively “redirect” from http://domain.com to http://www.domain.com. Of course the URL rewrite has many more uses and features, but we will use it for redirection purposes in this tutorial.To install the IIS URL Rewrite module: Go Here and click install… Or just click here. Once installed you may need to reboot.
Install IIS URL Rewrite Module
IIS URL Rewrite after Installation
You can double click and make your URL rewrite rule using the interface, or edit the web.config. See below.
IIS URL Rewrite Module
IIS URL Rewrite code in the web.config
IIS URL Rewrite http:// to http://www<!--web.config url rewrite--> <system.webServer> <rewrite> <rules> <rule name="RedirectToWWW" stopProcessing="true"> <match url=".*" ignoreCase="true" /> <conditions> <add input="{HTTP_HOST}" pattern="^domain.com$" /> </conditions> <action type="Redirect" url="http://www.domain.com/{R:0}" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer>
Previous to IIS7 this was handled in:
Older IIS URL Rewrite was contained between these tags
<system.web> </system.web>
The above code can be viewed in the URL rewrite module interface. It’s illustrated below. You may add or modify in either the web.config, or this interface. The main thing is to get it installed, and most likely reboot.
URL Rewrite Rules Interface in IIS
URL Rewrite Interface in IIS
IIS 7 redirect using URL Rewrite
Notice under the “Action” section in the above image there is a selection for “Action type”. Among other choices you can choose Redirect. Choose “Redirect.” Once selected there are then places for you to select “Redirect URL,” and “Redirect type,” such as “Permanent (301).”Search Terms:
URL Rewrite, URL Rewrite IIS, iis 7 redirect, http://domain.com to http://www.domain.com, IIS URL Rewrite, IIS urlrewrite, URL rewriting, IIS rewrite, rewrite url, urlrewrite, URL Rewrite asp.net, url rewriting asp.net, URL Rewrite module, IIS7 URL Rewrite module, IIS rewrite url, url rewrite tutorial, url rewriting IIS, IIS url rewriting, rewrite IIS, asp url rewrite, IIS7 rewrite, asp.net rewrite url, IIS7 rewrite, IIS redirect url, rewrite url asp.net, IIS url rewrite module, asp.net url rewriting, http redirect, url redirection, IIS redirect.
转:http://www.surfingsuccess.com/asp/iis-url-rewrite.html#.UnxhxlBplLA
相关文章推荐
- HTTP Response Compression in a URL rewrite enabled IIS installation
- IIS URL Rewrite 重定向域名到www
- IIRF(Ionic's Isapi Rewrite Filt er)入门,在IIS上重写Url[转 ]
- asp.net iis URLRewrite 实现方法详解
- 开源的iis urlrewrite:IIRF
- URLRewriteFilter usage - use-query-string="true" and use-context="true"
- 使用Microsoft URL Rewrite Module for IIS 7.0修改WEB.CONFIG即可实现*.HTML伪静态 无需修改应用程序映射
- http://www.iis.net/downloads/microsoft/url-rewrite
- iis url rewrite配置
- Nginx rewrite URL examples with and without redirect address
- iis url重写模块 2 Rewrite
- Nginx rewrite URL examples with and without redirect address
- IIS UrlRewrite添加规则
- IIRF(Ionic's Isapi Rewrite Filt er)入门,在IIS上重写Url
- eclipse server locations disabled and need to change to use tomcat installation
- IIS URL Rewrite 2.0,url重写,伪静态
- IIRF(Ionic's Isapi Rewrite Filt er)入门,在IIS上重写Url
- IIS URL Rewrite Module的防盗链规则设置
- Microsoft URL Rewrite Module for IIS 7.0
- IIS URL Rewrite 重定向域名到www