Problem with images not displaying because domain is incorrect I have recently installed a Drupal site on our web server and this is the default host (replaced an old website with static files). This server also hosts another virtual host for another domain name and that installation is WordPress.

On blog posts on the Drupal site (regular pages are fine), images will eventually show broken icons and when you check the URL of the image, it's replacing the domain name for the Drupal site with the domain name for the WordPress site.

Clearing the cache within Drupal immediately fixes everything, and the images reappear and with the correct URL.

An additional oddity is that the images are broken inside our network, but from the outside they will show up even though using the incorrect URL. On the inside, it resolves to the internal IP address and on the outside to the public.

I'm using Apache 2.2.22 with Drupal 7.28.

I realize it could be an Apache issue or DNS issue, but I'm checking all avenues... is there a configuration for the Drupal cache that I should be taking a look at that could be causing this problem?
The first thing you need to do is stare at your Apache access logs for a while and see if you have inbound requests to the wrong URL.  You may need to configure per virtual host logfiles to see which vhost is handling which.

You may also want to disable Drupal caching (both page and block) to see if the problem persists.

My guess is that everything with your Drupal configuration is correct, but that you have inbound requests that Drupal is handling because it is the default site, and these are getting cached.

If the Apache logs indicate that Drupal is getting the wrong URL, then I would do the following:


Configure both virtual hosts to respond to the canonical URL, and the redirections.  Something like

ServerName www.example.com
ServerAlias example.com *.example.com


This will make sure the proper vhost is responding to the proper domain (which is guess is the root cause of your problem, ie you need a ServerAlias).


Configure httpd.conf or .htaccess to set up canonical URL redirection for both the Wordpress and Drupal sites.  Something like

RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301]


These help ensure that Drupal and Wordpress only ever see requests for a single hostname.

These two things make good sense on most live sites, too.

If you still have the wrong URLs and you are 100% positive about the traffic, then my next guess would be that you have a misconfigured settings.php somewhere in your organization, and you have two sites / servers running out of the same database (eg, DEV and LIVE are actually using the same database).  To fix this, you would need to find the offending site.