Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Anchor CMS on my server running Lighttpd, and I am trying to setup pretty url's. I have anchor installed in a sub-directory "/blog".

The htaccess file that works with anchor cms in apache is:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog

    # Checks to see if the user is attempting to access a valid file,
    # such as an image or css document, if this isn't true it sends the
    # request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [L]

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php

This is the rewrite rule I have in lighttpd:

url.rewrite-if-not-file += ( "^/blog/(.*)$" => "/blog/index.php/$1")        

The urls are now pretty, but none of the static content is loading, ie css, javascript and images. I thought using url.rewrite-if-not-file would cover this, but it doesn't seem to be working for my installation.

The following urls and their files need to be kept intact:

  • /blog/themes/default/{ js | css | img }
  • /blog/anchor/views/assets/{ js | css | img }

The theme directory can change depending on the theme currently being used. So instead of "default" it could be "example". I am not very good with regex, so I could really use some help. I was thinking something along the lines of this might work:

url.rewrite-once += ("^/blog/themes/(.*.)/(css|js|img)/(.*)" => "$0")

Any assistance with this would be greatly appreciated. Lighttpd uses regrex similar to perl

share|improve this question
up vote 0 down vote accepted

I got this working with the following rewrite rules:

url.rewrite-if-not-file += ( "^/(.*)\.(css|js|jpg|png|gif)$" => "$0",
                             "^/blog/(.*)$" => "/blog/index.php/$1" )

I hope this helps someone else running anchor cms on lighttpd

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.