(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);

Image links in CSS are not stored in the database. That would be in the CSS file. Using a browser "inspect" the code by right clicking on the background in Chrome for example. Navigate the DOM to find the css reference to the background image. It will show you the CSS line where you need to update. Make sure you have aggregate CSS turned off in the performance section of the admin configuration. Also, make sure ANY links you generated ANYWHERE are always relative links. There are rare exceptions, but I don't know of any worth mentioning there.

The home icon is not set in the database. It is taken from the settings.php file located in sites/default/settings.php (or when you first setup Drupal). Change the $base_url to mysite.net. Clear caches, admin/config/development/performance. If you still can't get it with this information, please update your post to include more information about how you set things up and what you have tried.


The problem was to do with the File System.

If you've got image urls which use it to generate part of the URL these don't reset as you would expect.

Drupal appears to cache this in some place which isn't cleared by any of the regular cache cleans.

Entering an incorrect path for the file system and then changing back to the correct one fixed all the image generation for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.