Jump to content

Problem with images on localhost


nethnet

Recommended Posts

Hi guys,

 

I've recently installed WAMPServer on my new Windows 7 machine, but I am having some difficulties with the localhost.  I've previously used WAMPServer for Mac as well as my old Windows XP machine, neither of which gave me any problems.

 

The issue I am running into is that when I navigate to my localhost/ in my browser, the typical WAMPServer index page is displayed, as it should.  The images on this page display correctly.  However, when I move to my nethnet/ subdirectory, in which I have all of my project files, none of the images load.  The page loads everything else correctly, but all images display as broken files.

 

Every reference to images in my nethnet/ subdirectory is done relatively, by using <img src="images/file.gif" />.  It is important that these references remain relative and not absolute, so that when I move the site to my online server, everything remains the same.  Right-clicking on a broken image and viewing its properties shows me that the filepath to the image is correct:

 

http://localhost/nethnet/images/thumb_endure.gif

 

Alternatively, when I access my local server directly in my browser using it's actual filepath, everything displays properly.  What would be giving me troubles in displaying images on my localhost?

 

file:///C:/wamp/www/nethnet/index.php  <- Displays the site perfectly

http://localhost/nethnet/index.php  <- All images are broken

 

Is there some misconfiguration with Apache that could be causing this?

 

Thanks,

Theo

Link to comment
https://forums.phpfreaks.com/topic/212897-problem-with-images-on-localhost/
Share on other sites

No, I don't.  There are no .htaccess files anywhere on my local server, and the Apache configuration is minimal, with no non-default extensions loaded.

 

As far as working with the Apache core goes, I'm very inexperienced, but the fact that accessing my server with file:///C:/wamp/www works fine and http://localhost/ has problems with images suggests that there is something going fishy with the localhost rewrite..  Right?

 

I've been going at this for days now and I'm completely lost.  Would I be better off just getting a new server instead of using WAMPServer?  If so...  Any suggestions?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.