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);
link|improve this question
Do you have any mod_rewrite directives intended to block image hotlinking? – danlefree Jan 4 '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 4 '11 at 22:38
feedback

3 Answers

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.

link|improve this answer
feedback

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).

link|improve this answer
feedback

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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