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
Register
Register | 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 10th, 2013, 03: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.

newsite.mylcl.lan
oldsite.mylcl.lan

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:

REDIRECT RULE

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



REWRITE RULE

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

</rewrite>

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.

Thanks!
Reply With Quote
Reply


Thread Tools
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 02:05 AM
rewrite problem twr195 Beginning PHP 1 March 11th, 2008 01:49 PM
isapi url rewrite question rykiel Classic ASP Professional 0 October 9th, 2007 04:22 AM
problem with URL rewrite mlcy ASP.NET 2.0 Professional 3 June 21st, 2007 07:05 PM



All times are GMT -4. The time now is 08:16 AM.


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