How to update relative image paths on domain migration? (Incorrectly generates previous) Problem

(Found the same problem recently, re-wrote question to be more general and useful)

I recently had to change the domain of my site.

On changing it I've found Drupal fails to update the domain of the URL in a lot of the images on my site.

So for example, I changed from domain1 to domain2:

The path for a background image in a CSS file would originally be:

background-image: url (https://domain1.com/sites/all/themes/tefltheme/images/empty1.gif)


After changing the domain it would remain:

background-image: url (https://domain1.com/sites/all/themes/tefltheme/images/empty1.gif)


Nothing I do seems to cause this to re-generate. Has anyone else run into this? Where is Drupal storing this information?

What I've done


Clear caches
Flush memcache, varnish and drupal 
Wipe all Advagg files and re-generate 
Set the base URL in settings.php


On the back-end it recognises my URL has changed for example /admin/config/system/site-information shows domain2 in all the prefixes.

(I can fix this by putting an exact path in all my CSS etc, but obviously I'd prefer to avoid this.)
If your CSS file and "images" folder are in "mytheme" folder, the CSS string should be:

background-image: url(../images/homepagenew4.jpg);