Magento Relative Paths of images on localhost
I have a website based on magento and it works well. Couple days ago I downloaded the website to make a local copy, everything went fine, everything works.
but... on my landing pages, I use relative paths for my images and landing pages dont show the relative paths, I thought it was htaccess problem, so I enabled mod rewr开发者_C百科ite in xampp, AllowOverrides is on - All, downloaded htaccess file from ftp and copied in my local, development website root.
still the same problem. Example:
<a href="/ipods-portables/headphones.html"> <br /> <img title="Headphones" src="/media/pages/home/headphones.jpg" alt="Headphones" width="442" height="200" /></a>
(I edited html tags, it doesnt let me post them here, but they are correct on my websites)
This code works well on my live website, but on my localhost it doesnt load an image. When I check it in firebug, it says "failed to load given URL". URL is correct though, same url works well on my live website.
Any ideas please? help is much appreciated : ))
Edit: If I change relative paths of images in firebug and add two dots before the slash like this >> ../relative path here << then the images show up well, I dont get it, why does it show images on my live website relative paths without two dots in the beginning and why doesnt it show images on my localhost?
You have wrong idea about what path (note that url and path are different things) is relative and what is absolute:
this is absolute path from your domain root and those all are equivalent:
src="/media/pages/home/headphones.jpg"
src="http://localhost/media/pages/home/headphones.jpg"
src="http://productiondomain.com/media/pages/home/headphones.jpg"
this is a relative path from the page/dir you are visiting and are available from this point only (if defined correctly):
src="media/pages/home/headphones.jpg"
If your site is on localhost then your image is looked up from abs.url+abs.path and you should verify that the /media directory is on your domain root. If your site is on some subfolder on your localhost then the path just won't match and you should either rename all paths or add base dir rule to htaccess or base href rule to your html.
精彩评论