Project

General

Profile

[Solved] Need help implementing apache equivalent mod_rewrite functionality in lighttpd

Added by hk.ontheweb about 8 years ago

Here's the mod_rewrite .htaccess file which is meant to work on Apache Servers for my web-app

RewriteEngine On
RewriteBase /cs200/tokens/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

These are some relevant $_SERVER parameters which may be useful.

$_SERVER["REQUEST_URI"]- /cs200/tokens/
$_SERVER["DOCUMENT_ROOT"]- /var/www/servers/www
$_SERVER["SCRIPT_FILENAME"]- /var/www/servers/www/cs200/tokens/index.php
$_SERVER["PHP_SELF"] - /cs200/tokens/index.php

I have a lighttpd server in which I want to implement the same functionality of this .htaccess file. I have referred to a lot of sources online and came up with these. But none of them actually work. Let's say my domain name is www.example.com. I've tried the following examples and none of these do the trick

$HTTP["host"] =~ "www.example.com" {

url.rewrite-once = (
"^/cs200/tokens(.*)" => "/index.php"
)
}

example 2

$HTTP["host"] =~ "www.example.com" {

url.rewrite-once = (
"^/cs200/tokens/(.*)" => "/cs200/tokens/index.php"
)
}

None of these seem to be doing the functionality of this apache .htaccess file on lighttpd. This issue has been bugging me for the past 12 hours and I've sort of want to give up on this issue. I'm a little inexperienced with regex so that could also possibly be the issue. Can anyone please help me?

My server runs Debian with Lighttpd 1.4.39 and Browser used is Chrome/Firefox


    (1-1/1)