Search
Home IIS.NET Forums IIS 7 & IIS 8 URL Rewrite Module URL Rewrite Replace
Last post Mar 02, 2012 08:09 AM by Dalong Zhang - MSFT
1 Post
Feb 29, 2012 07:49 PM|LINK
I am trying to do something that should be very simple using URL Rewrite module on IIS but I cannot find the correct syntax.
I am trying to test a site using the IP address before we move to a different server.
I want to replace something like www.thesitename.com/infopage.htm with http://123.45.678.90/infopage.htm
Any suggestions would be appreciated.
URL Rewrite
647 Posts
Microsoft
Mar 02, 2012 08:09 AM|LINK
Hi,
You can adjust the following rule and put it to the web.config file of your website:
<rule name="Page redirect" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^123\.45\.678\.90$" negate="true" /> </conditions> <action type="Redirect" url="http://123.45.678.90/{R:0}" /> </rule>
with above rule, all requests to your domain will be redirected the corresponding page with IP address.
To learn more about URL Rewrite Rules, please refer to the following article:
Creating Rewrite Rules for the URL Rewrite Module http://learn.iis.net/page.aspx/461/creating-rewrite-rules-for-the-url-rewrite-module/
trstill
1 Post
URL Rewrite Replace
Feb 29, 2012 07:49 PM|LINK
I am trying to do something that should be very simple using URL Rewrite module on IIS but I cannot find the correct syntax.
I am trying to test a site using the IP address before we move to a different server.
I want to replace something like www.thesitename.com/infopage.htm with http://123.45.678.90/infopage.htm
Any suggestions would be appreciated.
URL Rewrite
Dalong Zhang...
647 Posts
Microsoft
Re: URL Rewrite Replace
Mar 02, 2012 08:09 AM|LINK
Hi,
You can adjust the following rule and put it to the web.config file of your website:
<rule name="Page redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^123\.45\.678\.90$" negate="true" />
</conditions>
<action type="Redirect" url="http://123.45.678.90/{R:0}" />
</rule>
with above rule, all requests to your domain will be redirected the corresponding page with IP address.
To learn more about URL Rewrite Rules, please refer to the following article:
Creating Rewrite Rules for the URL Rewrite Module
http://learn.iis.net/page.aspx/461/creating-rewrite-rules-for-the-url-rewrite-module/
Feedback to us
Develop and promote your apps in Windows Store