Frage

I duplicated my magento store to my local xampp server. Now none of the images which are referenced with a relative url are displayed (e.g. buttons).

In the phtml files, these images are referenced through

<img src=/skin/default/default/images/button.jpg>

When I give them an absolute url in form of

<img src=http://localhost/magento-test/skin/default/default/images/button.jpg>

it works. I tried modifying my local .htaccess with

RewriteBase /magento-test/ 

and

RewriteBase /

and I also changed disabled and endable URL rewrites in the backend. I also have

 http://localhost/magento-test/

as my base url in the backend.

But the images still don't show up on my local frontend. Any suggestions?

War es hilfreich?

Lösung

To avoid a whole lot of headaches like this, you should reference your images using the getSkinUrl() method in your template files. For example, you'd use:

<img src="<?php echo $this->getSkinUrl('images/button.jpg') ?>" />

This builds an absolute reference to your image, using the appropriate URL in your admin area.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top