Help w/rewrite from old web to new with exception

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 3
Joined: 25 Apr 2013, 15:46

Help w/rewrite from old web to new with exception

25 Apr 2013, 15:55

Situation:
I have a website fh.floridahospital.com that I want users to go to www.floridahospital.com except if the user goes to fh.floridahospital.com/heartland. The sites are hosted on two different machines.

<VirtualHost fh.floridahospital.com floridahospital.com>
RewriteEngine on
AllowOverride All
RewriteBase /
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!fh\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://fh.%2%3 [NC,R=301,L]

RewriteRule ^/heartland$ http://fh.floridahospital.com/heartland/home.aspx [NC,R=301,L]
RewriteRule ^/heartland/(.+)$ http://fh.floridahospital.com/heartland/$1 [NC,R=301,L]

#My entry
#Permanent redirect to update old links
RewriteRule (.+) http://www.floridahospital.com [R=301,L]

</VirtualHost>

Any help is greatly appreciated.

Thanks,
Edward

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help w/rewrite from old web to new with exception

25 Apr 2013, 19:31

Hello, try to replace existing with the following rule:


Code: Select all
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^fh\.(.+)$ [NC]
RewriteCond %{REQUEST_URI} !^/heartland.* [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://fh.%2%3 [NC,R=301,L]

and
Code: Select all
RewriteRule ^heartland$ http://fh.floridahospital.com/heartland/home.aspx [NC,R=301,L]
RewriteRule ^heartland/(.+)$ http://fh.floridahospital.com/heartland/$1 [NC,R=301,L]


Regards
Andrew

User avatar
Posts: 3
Joined: 25 Apr 2013, 15:46

Re: Help w/rewrite from old web to new with exception

26 Apr 2013, 15:08

Andrew,
Thank you for your reply. When I added your entry I got the following in the address bar:

http://fh.floridahospital.com/,http://fh.floridahospital.com/Default.aspx?TabId=6686&language=en-US
http://fh.floridahospital.com/heartland/,http://fh.floridahospital.com/Default.aspx?TabId=2171&language=en-US

Which displays the following error in the browser:
A potentially dangerous Request.Path value was detected from the client (:).

Here's what I have:
<VirtualHost fh.floridahospital.com floridahospital.com>

RewriteEngine on
AllowOverride All
RewriteBase /
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^fh\.(.+)$ [NC]
RewriteCond %{REQUEST_URI} !^/heartland.* [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://fh.%2%3 [NC,R=301,L]

RewriteRule ^heartland$ http://fh.floridahospital.com/heartland/home.aspx [NC,R=301,L]
RewriteRule ^heartland/(.+)$ http://fh.floridahospital.com/heartland/$1 [NC,R=301,L]

</VirtualHost>

User avatar
Posts: 3
Joined: 25 Apr 2013, 15:46

Re: Help w/rewrite from old web to new with exception

26 Apr 2013, 15:40

Forgot to add this to my previous post:

#My entry
#Permanent redirect to update old links
RewriteRule (.+) http://www.floridahospital.com [R=301,L]

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help w/rewrite from old web to new with exception

26 Apr 2013, 18:25

There're 2 options:

- Double-registration. Check here how to fix it http://www.helicontech.com/articles/isapi_rewrite-double-registration/
- The Location header on your side is setup twice, but it has nothing to do with ISAPI_Rewrite

Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 17 guests