RewriteEngine on
RewriteRule ^packed\.js$ pack.php?debug=0 [nc]
RewriteRule ^debug$ pack.php?debug=1 [nc]

That worked fine on apache in a .htaccess file placed in a specific directory. If I want to do this on lighttpd, do I have to add it in the config file or something?

Would I need to make any changes to these rules?

Accepted Answer

lighttpd doesn't support .htaccess files like Apache httpd does. That's where the "light" in "lighttpd" comes into play.

You can, however, migrate these rules from Apache httpd's mod_rewrite to lighttpd's mod_rewrite. But be aware that the NC flag (case-insensitive matching) is not supported by lighttpd's mod_rewrite. If you are fine without it, you could simply use the following rewrite rules:

url.rewrite-once = (
    "^packed\.js$"  => "pack.php?debug=0",
    "^debug$" => "pack.php?debug=1" 

If you need the match to be case-insensitive, you'll probably need to invoke mod_magnet and a custom Lua script.

Written by joschi
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the community.
It is licensed under cc-wiki