Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Servers > Internet Information Services
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Internet Information Services Limit this to IIS questions and posts. ASP/ASP.NET questions should still go in the ASP/ASP.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Internet Information Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 10th, 2013, 02:36 AM
Registered User
Points: 35, Level: 1
Points: 35, Level: 1 Points: 35, Level: 1 Points: 35, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jul 2013
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default URL Rewrite (hostname rewrite) not working

Hello folks, I am having an issue trying to rewrite an URL.

This is the scenario. I have a new website that is replacing an old website (each one in a separate server). The new site is up and running and we want to redirect users that are still going
to the old website to the new site. So we changed DNS of the old site to point to the IP of the new site. However, we want to rewrite the old hostname in the URL to the new hostname we are
using for the new site.


The new site is running IIS 7.5 and I installed URL Rewriter 2.0 without any problems.

I have tried this using rewrite and redirect rules, none of them are working, here are the two rules I have tried:


<rule name=”Redirect” stopProcessing=”true”>
<match url=”.*” />
<add input=”{HTTP_HOST}” pattern=”^oldsite.mylcl.lan$” />
<action type=”Redirect” url=”http://newsite.mylcl.lan/{R:0}” redirectType=”Permanent” />


<rule name="Rewrite" enabled="true" stopProcessing="true">
<match url=".*" />
<add input="{HTTP_HOST}" pattern="^oldsite.mylcl.lan$" />
<action type="Rewrite" url="http://newsite.mylcl.lan/{R:0}" appendQueryString="false" />


When I type the old site URL in my browser, it goes to the new site, however, the old site URL remains in the address bar and it is not rewritten.

When it comes to regular expressions, I am an ignorant, so I am pretty sure I got something wrong here. However, I based these rules on some examples I found on the Internet.

Most of the examples I found are instruction on how to rewrite an URL for the same website, so the hostname of the URL is not rewriten/touched at all. But as you can see, in my
case, what I need to rewrite is the hostname.

I really appreciate your help on this issue, I have been going crazy and don' know where else to look on how to accomplish this.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rewrite URL for subdomain phuc2583 ASP.NET 3.5 Professionals 0 November 26th, 2009 09:22 PM
URL Rewrite kumiko Classic ASP Basics 1 April 17th, 2008 01:05 AM
rewrite problem twr195 Beginning PHP 1 March 11th, 2008 12:49 PM
isapi url rewrite question rykiel Classic ASP Professional 0 October 9th, 2007 03:22 AM
problem with URL rewrite mlcy ASP.NET 2.0 Professional 3 June 21st, 2007 06:05 PM

All times are GMT -4. The time now is 05:58 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.