Use absolute image path in CSS (3 posts)

  1. Ozh
    Posted 11 years ago #

    In blogs using permalinks rewrite rules, be sure in your CSS to give images an absolute path. If not, here is what you get :
    - if your image is located in "/blog/wp-images/new-comment.gif"
    - in "/index.php" : img src is "wp-images/new-comment.gif", this is ok
    - in "/archives/2004/04/04/this-is-cool/", img src is "/archives/2004/04/04/this-is-cool/wp-images/new-comment.gif", which wont work

    I've seen this a few times and just a few minutes ago in http://weblogtoolscollection.com/ , be sure to pay attentio to this :)

  2. Laughinglizard
    Posted 11 years ago #

    Point well taken. The problem with http://weblogtoolscollection.com is with the new comment/new post images and NOT the CSS. Absolute path in the CSS is still maintained even with permalink rewrite rules because it depends on the location of the CSS file (which is set with an absolute path inside the index.php) and not the location of the index.php file or the permalink.
    I will take steps required to fix the new comment/new post graphics. Thanks for the great catch!

  3. Chris J. Davis
    Posted 11 years ago #

    You don't need to use absolute URI's with mod_rewrite, only make sure to add a preceding slash to all your image paths.
    That is all.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.