Jay Walker
Jay Walker

Reputation: 4713

Switch hosting providers - redirect users to new site before and after DNS updates propagate

We want to switch hosting providers. To do so will require a DNS update for the IP address associated with our domain.

Content has been tested and brought up on the new server. The DNS update has been made but users are not able to see the new site until the DNS propagates (which could be days).

Is there a something that can be done on the old server so that if it receives a request, it can forward/redirect to the new server, thereby eliminating the 'DNS downtime'?

We are running ASP.net 3.5 on IIS6 with ISAPI_rewrite 3.0.

Upvotes: 1

Views: 1365

Answers (2)

Jay Walker
Jay Walker

Reputation: 4713

Our solution (per Darryl's suggestion - but this is too much info for a comment)

We use ISAPI_Rewrite 3.0 which is a fantastic and low cost tool for url management so this solution is tailored to that product but conceptually should be valid for other environments.

DNS (for mydomain.com)

A   newsub    newIP   #(new record)
A   existing  newIP   #(updated IP)

IIS Configuration for site at new Host:

Add newsub as a hostheader on site

.htaccess for site at new host

#add as first rule. trap requests for new subdomain and redirect to existing
#ASSUMES that redirect to existing is now safe because DNS for existing
#was updated when newsub DNS was queried.
#otherwise this is going to be an endless loop of 
#redirects between the old and new server
RewriteCond %{HTTP_HOST} ^newsub\.
RewriteRule ^(.*)$ http://existing.mydomain.com/$1 [R=302, L]

.htaccess for site at old host

#add as first rule. redirect all requests to new subdomain
RewriteCond %{HTTP_HOST} ^existing\.
RewriteRule ^(.*)$ http://newsub.mydomain.com/$1 [R=302, L]

Upvotes: 2

Darryl Hein
Darryl Hein

Reputation: 145107

You could setup a separate subdomain, redirecting users on the old server to that domain and have the new server accept requests from that subdomain. New subdomains (A records) should propigate much faster than changes. Once the DNS is fully propigated, you can just redirect that subdomain/A record to the regular address.

Upvotes: 1

Related Questions