Page 1 of 1

misssing image help me

PostPosted: 17. August 2011 07:04
by david01234
Hello
I downloaded a copy of my site to the htdocs folder, everthing works fine except I can't see the images. The images on the live site uses a relative path so I assume that's why this is happening. On my local server it's looking for the images using this path: http://127.0.0.1/images/myimage.gif but the correct path on my local server is http://127.0.0.1/mysite/images/myimage.gif

Is there something I can do to fix this so that when I upload the site I don't have to change all the paths again.

Thank you!!

Re: misssing image help me

PostPosted: 17. August 2011 07:52
by Sharley
Hello

Your path may look like this /images/myimage.gif which is asking Apache, on your local server, to look in the htdocs folder (the web root folder or DocumentRoot folder of the server) for the myimage.gif file located in the image folder which does not exist - your current problem.
The C:\xampp\apache\logs\error.log file should have the 404 error details to confirm this.

Remove the / from your path so it looks like this images/myimage.gif and then Apache will look for a folder images in your mysite folder in the htdocs folder - the solution.

On your hosted server this change to your path should not give you any issues as your site is in the equivalent of the htdocs folder, ie. the web root or DocumentRoot folder of the hosted server.


If you feel you don't want to change your paths then alternatively you can remove the 2 index files and all the other image files that are in there and simply place your web site directly in the htdocs folder, no need then for the folder mysite.
http://localhost/ will give you your site as it would appear on your hosting server.
http://127.0.0.1/ will also work.
http://localhost/images/myimage.gif will show you the expected gif file.
http://127.0.0.1/images/myimage.gif will also work now.

If you want the XAMPP welcome page after removing the 2 index files from the htdocs folder and you have not deleted the xampp folder from the htdocs folder then simply type in your browser http://localhost/xampp/index.php and you should still be able to use it's functions - you would obviously not upload any files or folder from the htdocs folder that do not belong to your web site.


There is a third alternative, which is slightly more complicated and that is to create a virtual host for your web site in the C:\xampp\apache\conf\extra\httpd-vhosts.conf file - more on that if you need it or you could do an advanced forum search for vhosts in the XAMPP for Windows forum which should return many viable and working configurations in the results (you could use my forum handle Sharley in the Author box to help narrow and consequently reduce the effective returned search results).

Best wishes.