I am preparing to launch a new website for a large hospital health care system. URLs from the old site need to be redirected to the new site. I am attempting to use ISAPI_Rewrite 3.0 to do this, but it is not working as expected.
Both the old and new sites are in DotNetNuke 6.1.5 on Windows Server 2003 and are hosted on the same Windows Server 2008 with IIS 7.5 with IIS 6.0. The old site has been upgrade from DNN 4.x to 5.x and then to 6.x. The new site is a fresh install of 6.x with minor updates to the newest versions.
I have used ISAPI_Rewrite 3 in the past on a DotNetNuke site hosted on Windows Server 2003 with IIS 6.0 and it works fine. I am wondering if the problem is specific to IIS 7.5.
I will make up names for the two sites, but the address to the right of the host/domain is what I am actually using in the httpd.conf.
The old site is: www.myhospital.com
The new site is: dev.myhospital.com
I also added an IIS host header and a DNS A record for old.myhospital.com on the www site for testing. I need to keep the old site online while I develop the RewriteRule entries in the httpd.conf. At launch, I will use 301 redirects, but I am using 302's for testing.
www.myhospital.com and old.myhospital.com point to the old live site.
dev.myhospital.com points to the new site.
For debugging the problem I am having, I also created a new host on another domain on a new website hosted on the same web server as the above two sites. It contains one file, default.aspx with the content "It works!"
Here is the httpd.conf file:
---
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.89
# Registration info
RegistrationName= xxxxxxxxxx
RegistrationCode= xxxxx-xxxxx-xxxxx-xxxxx
RewriteEngine off
AllowOverride none
<VirtualHost old.myhospital.com>
RewriteEngine on
AllowOverride all
RewriteRule ^/Test1/Default.aspx http://www.google.com [R=302,NC,L]
RewriteRule ^/HealthCareServices/DiabetesandNutritionTherapyCenter/NutritionTherapy/tabid/463/Default.aspx http://dev.myhospital.com/HealthCarebrServices/HealthServices/DiabetesNutritionTherapy/NutritionTherapy.aspx [R=302,NC,L]
</VirtualHost>
<VirtualHost test.anothersite.com>
RewriteEngine on
AllowOverride all
RewriteRule ^/Test2/Default.aspx http://www.google.com [R=302,NC,L]
RewriteRule ^/HealthCareServices/DiabetesandNutritionTherapyCenter/NutritionTherapy/tabid/463/Default.aspx http://dev.myhospital.com/HealthCarebrServices/HealthServices/DiabetesNutritionTherapy/NutritionTherapy.aspx [R=302,NC,L]
</VirtualHost>
---
If I browse to:
http://old.myhospital.com/HealthCareServices/DiabetesandNutritionTherapyCenter/NutritionTherapy/tabid/463/Default.aspx
it should redirect to:
http://dev.myhospital.com/HealthCarebrServices/HealthServices/DiabetesNutritionTherapy/NutritionTherapy.aspx
However, it actually redirects to:
http://www.myhospital.com/Default.aspx?TabId=463
I don't understand how the rule to redirect to the dev site results in a redirect to the www site. Digging deeper, I find if I completely remove the VirtualHost sections with RewriteRule lines from the httpd.conf, I get the same result. It appears the rule is being ignored completely and somehow the URL is being mangled somewhere else.
If I browse to:
http://old.thompsonhealth.com/Test1/Default.aspx
Instead of being redirected to:
http://www.google.com
it redirects to:
http://dev.thompsonhealth.com/Test1/Default.aspx,http://www.google.com
Notice there is a wrong dev URL, followed by a comma, and then the URL for Google.
If I remove the VirtualHosts and RewriteRule lines from httpd.conf, it redirects to:
http://dev.thompsonhealth.com/Test1/Default.aspx
This also is wrong, but different.
From here, I moved on to testing on www.anothersite.com (not the actual URL). It works!
If I browse to:
http://www.anothersite.com/HealthCareServices/DiabetesandNutritionTherapyCenter/NutritionTherapy/tabid/463/Default.aspx
it redirects to:
http://dev.myhospital.com/HealthCarebrServices/HealthServices/DiabetesNutritionTherapy/NutritionTherapy.aspx
This is the correct redirection.
Also, if I browse to:
http://www.anothersite.com/Test2/Default.aspx
It redirects to:
http://www.google.com
This also is correct.
Why does this work fine for the non-DotNetNuke site, but fail for the DotNetNuke site? How do I fix this?
Any help would be greatly appreciated!
Thanks,
-Pat