ok - I think I'm stuck with no way to redirect old site to new IP address
This is almost comical but I'm stuck at this point. Here's the situation:
current host: no root access, can really only work in .htaccess
current host: site to be moved to new host is on a shared IP address
current host: site has .htaccess redirecting all non-www traffic to www.
new host: root access, WHM, all the knobs/dials
new host: mod_userdir is disabled
OK. So, at the current host I can't add an .htaccess redirect like this:
RewriteRule ^(.*)$ http://1.2.3.4/~accountname/$1 [R=301,L]
since mod_userdir is disabled at the new host -- and I'm told that enabling it is not exactly simple. So that IP address and account name will not resolve.
Great - so at the new host let's put the site at a dedicated IP address. Nope,that won't work either because the .htaccess rule that rewrites all traffic to "www." means it will break - you get this:
www.1.2.3.4 -- server DNS address could not be found.
I'm afraid to turn off that "www." rewrite rule because it was put in place years ago and I'm not sure what might break if it's not there.
So at this point I see no way to move this site and have the old site redirect to the new site. I have TTL set very low so I am going to have to count on the global DNS caches refreshing in a reasonable amount of time (I can tolerate 24 hours).
My head hurts. Am I missing anything or should I just go with the game plan to move the site and not even attempt to do the redirect from the old location?
I'm copying this answer from your other question, because it's actually more relevant with your new details. It's entirely doable with just .htaccess
on the current host.
My example uses the www
subdomain but you can adjust it as needed.
On the new server / website, make sure it can service requests on both www.example.com
and a second subdomain of your choosing that won't scare end users. I usually go with www2.example.com
.
When you are ready to cut over, change DNS to point to the new IP, then on the old server, reconfigure the site so that it does an HTTP redirect for all requests to www2.example.com
. This should not be a permanent (301) redirect, use 302 or 307.
The result is that any clients who get the new DNS entry go to the new server as they should.
Any clients who have a cached entry hit the old server, then get redirected to www2
which always pointed at the new IP so it can't be cached, and then they get the new server.
Some things may complicate this. For SSL, the certificate will need to include the temporary host name. If the site uses cookies, I'm not sure they will still work (or they won't transfer). You'll have to consider all the ways a different name might affect things, though in my experience there won't be a whole lot of people hitting the cached one and they will drop off quickly as long as your TTL is reasonably low.