Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

3 Answers 3

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

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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