To clarify what has been said.
Your website knows exactly where it is by what is defined in the configure.php files.
This is the ONLY place where the actual REAL name of the website www.whatever.com may be used in the entire ZC fileset.

NOWHERE else in the entire site should have the REAL address written in the code: it should use the constant that this address is assigned to: HTTP_SERVER or HTTPS_SERVER
and any reference to other files in the filesystem should use a combination of the CONSTANTS defined in configure.php to get there, never the actual paths.
If you don't do this, you get all the problems you are experiencing now where the site is not portable.

This is another example of why (I believe) one should develop locally, you would have found and solved this issue years ago when you first moved it online.