Friendly URLs on lighttpd
Last updated Aug 15th, 2026 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn morelighttpd does not use Apache-style .htaccess files. Friendly URL rewrites belong in lighttpd.conf (often /etc/lighttpd/lighttpd.conf on Linux).
This setup is uncommon for MODX hosting. Prefer Apache or nginx when you can. After rewrites work, finish the MODX steps in Using Friendly URLs.
Enable mod_rewrite¶
- Open
lighttpd.conf. - Find
server.modules. - Ensure
mod_rewriteis listed and not commented out. - Reload lighttpd after saving.
Add rewrite rules¶
Find the host / document-root block for the site, for example:
$SERVER["socket"] == ":80" {
$HTTP["host"] =~ "example.com" {
server.document-root = "/var/www/example.com"
server.name = "example.com"
Add rules under that host so existing files and the assets, manager, core, and connectors trees are not rewritten:
url.rewrite-once = (
"^/(assets|manager|core|connectors)(.*)$" => "/$1/$2",
"^/(?!index(?:-ajax)?\.php)(.*)\?(.*)$" => "/index.php?q=$1&$2",
"^/(?!index(?:-ajax)?\.php)(.*)$" => "/index.php?q=$1"
)
Exclude more paths¶
lighttpd only skips paths you list. To protect another web-accessible directory, extend the first pattern with |dirname, for example (assets|manager|core|connectors|media).
Reload lighttpd, then enable Friendly URLs in the Manager and clear the cache.
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










