WordPress.org

Support

Support » How-To and Troubleshooting » rewrite rule for static pages

rewrite rule for static pages

  • In my .htaccess file I’m using this:
    # START EZSTATIC RULE
    RewriteRule ^information/([^/]+)/?$ /index.php?static=$1 [QSA]
    # END EZSTATIC RULE
    The uri’s deplay how I want, but now the background images, etc don’t display as they are on my blog.
    Please help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • To make sure you always have the proper path to images (etc.), start at the root and work your way down. For example, say I have a background image in a directory called images, a subdirectory of my weblog’s root. I might point to it this way in my css:
    body {
    background-image: url(images/bg.jpg);
    }

    This works as long as a page resides in the directory where “images” is a subdirectory. Using mod_rewrite places pages (virtually) in other subdirectories, so the path to the images directory becomes invalid. To deal with this, I provide an absolute path to my background image, like so:
    body {
    background-image: url(/images/bg.jpg);
    }

    The slash (/) before images starts the directory path at the root, and now will always be located by a page.

    Bryan Villarin
    Happiness Engineer at Automattic

    @btvillarin

    Another alternative to EzStatic is Faked Folders (if you haven’t tried it already).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘rewrite rule for static pages’ is closed to new replies.