0

I am running a php site on my apache server (Mac). I am having trouble displaying images on the site when I access it externally or from another computer on the same server. If I try to access the image directly.

website.com/image.jpg I get a broken link icon and can't display the image.

Any ideas what could cause this?

My images are embedded using a style.css file.

background-image:url(image.jpg);
user65649
  • 131
  • 3
  • Do you have any `mod_rewrite` directives intended to block image hotlinking? – danlefree Jan 04 '11 at 22:32
  • no I do not. Does the RewriteEngine need to be on in order to display the images? or off? At the moment I do not have anything in the .htaccess file – user65649 Jan 04 '11 at 22:38

3 Answers3

1

If I try to access the image directly. website.com/image.jpg I get a broken link icon and can't display the image.

What does your webserver logs show? The answer is probably there.

Sounds like your webserver is trying to serve content from a different location where you think it should, or the mimetypes are not setup correctly.

symcbean
  • 21,009
  • 1
  • 31
  • 52
1

Is the image in the same path as the CSS? I believe url() embedding is relative to where the css file is, so if you have your css file in a sub directory, like styles/ for example, it'd expect the image to be in there. If you have it in the root directory, try using:

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

Also, make sure case of the name matches. Linux is case sensitive, so Image.jpg isn't the same as image.jpg (unless you have something like mod_speling enabled).

Jon Angliss
  • 1,782
  • 10
  • 8
0

Are your file permissions set correctly ? You might have no world read permission on that file. Try doing a chmod 755 image.jpg

alanboy
  • 111
  • 1