2

How it is set up now

I have a website which is setup for clean urls with apache mod_rewrite like this:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L,QSA]

The site also uses a CMS called Cockpit which lives under my public directory with a similar .htaccess file for it's clean urls:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

In both cases RewriteEngine On is present also (of course).

Now on apache this results in the urls of my website being rewritten like this

http://domain.com/a
http://domain.bom/b

and the cockpit urls do practically the same:

http://domain.com/cockpit/a
http://domain.com/cockpit/b

What I'm looking into So I've been looking into leaving apache behind for lighttpd and I've been messing around quite a bit with their mod_rewrite syntax and configuration but I have come across an issue where the cockpit urls aren't totally clean. This is how I have it set up on lighttpd:

$HTTP["host"] == "domain.com" {
        server.document-root = "/var/www/domain.com/public_html"
        index-file.names = ( "index.php" )
        $HTTP["url"] =~ "^(\/cockpit)(\/[a-zA-Z0-9\.]*)*$" {
                url.rewrite-if-not-file = ( "^(.*)$" => "/cockpit/" )
        } else $HTTP["url"] !~ "^(\/cockpit)(\/[a-zA-Z0-9\.]*)*$" {
                url.rewrite-if-not-file = ( "^(.*)$" => "/index.php" )
        }
}

This config setup works but the cockpit urls are now these:

http://domain.com/cockpit/index.php/a
http://domain.com/cockpit/index.php/b

I'd like to get rid of the index.php part of the url like apache did but I'm haven't been able to get this to work properly.

Anyone any ideas on this matter? s

Liam Martens
  • 141
  • 5

0 Answers0