Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to get vBulletin 5 up and running under lighttpd but I'm having some problems with url rewriting. Here is the apache .htaccess provided by vBulletin.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]

#needed because admincp is an actual directory.
RewriteRule ^(admincp/)$ index.php?routestring=$1 [L,QSA]

If this helps, this is the IIS config provided by vBulletin

<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is to support redirection in IIS.  It is harmless if you are running under Apache -->
                <rule name="Main Redirect" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    <action type="Rewrite" url="index.php/{R:1}" />
                <rule name="Admincp" stopProcessing="true">
                    <match url="^(admincp/)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php/{R:1}" />

Anyone have any suggestions as to the lighttpd url.rewrite equivalent? All my experiments have failed thus far.

I'm running lighttpd-1.4.31-1

I tried this but it didn't work. I think it has something to do with me not properly emulating [QS] in the .htaccess

url.rewrite-once = ("^(.*)$" => "index.php?routestring=$1",
                    "^(admincp/)$)" => "index.php?routestring=$1")

This has gotten me closer but not fully functional yet.

url.rewrite-if-not-file = ("^(.*)$" => "index.php?routestring=$1",
                    "^(admincp/)$)" => "index.php?routestring=$1")
share|improve this question
Which version of Lighttpd? –  mgorven Oct 25 '12 at 1:10
What have you tried that failed? It would be helpful to know how close you are. –  pjmorse Oct 25 '12 at 1:30
I added my lighttpd version number. As for what I tried so far, I can't even begin to recall all my changes. I'll add a few attempts I tried. –  Boots Oct 25 '12 at 16:18
add comment

1 Answer 1

up vote 2 down vote accepted

The regular expression is applied to the entire request URI, including the query string, so you need to deal with it explicitly. Try something like this:

url.rewrite-if-not-file = (
    "^/([^\?]+)(\?(.*))?$" => "index.php?routestring=$1&$3",
url.rewrite-once = (
    "^/(admincp/[^\?]+)(\?(.*))?$" => "index.php?routestring=$1&$3",

The second one for /admincp/ may not be necessary since rewrite-if-not-file doesn't match directories.

share|improve this answer
Thank you Michael, that did the trick I think. I'm going to do some more testing to confirm. –  Boots Oct 25 '12 at 23:10
Seems to work great. Thank you VERY much! –  Boots Oct 25 '12 at 23:13
add comment

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.