Seems the website was coded using absolute paths, which is not really good practice from Drupal coding standard's perspective. Please read the discussion on Absolute or relative URLs?. Your case is covered by the accepted answer:
When moving a site from dev > staging > production a Wordpress site's
URLs and image references have to be replaced in the DB, this can
create an absolute mess.
Though Wordpress is mentioned, that concerns any type of websites, including Drupal.
Anyway, to address the issue you need to do two things:
- Look for and replace all the instances of your old domain in the active theme's template folder. This is easier part as any decent text editor has Find&Replace feature.
Check the website again and if everything is working then you are lucky. If not proceed to the second step.
Search and replace all the instances of your old domain in the database tables. You can do it either using drush or UI like phpMyAdmin. The query is pretty simple:
UPDATE table_name SET field_name = replace(field_name, 'old-domain', 'new-domain');
To do so you first need to figure out the tables where your old domains could be stored. Most probably those are 'node' and 'comment' tables and their last revisions, however if content types have additional custom fields then more tables are involved. You could perform quick search for the old domain in the database to find all the tables where it is stored.
If step 2 is involved, then I would also suggest, using the opportunity, to turn all your paths from absolute to relative. In that case, you would run:
`UPDATE table_name SET field_name = replace(field_name, 'old-domain/', '/');`
instead.
I hope this helps.