WordPress.org

Support

Support » Your WordPress » Use absolute image path in CSS

Use absolute image path in CSS

  • 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 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Laughinglizard
    Member

    @laughinglizard

    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!

    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.
    Jesuit

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use absolute image path in CSS’ is closed to new replies.