Friendly URLs on lighttpd
Last updated Oct 11th, 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, connectors, and .well-known paths are not rewritten. core/ is deliberately left out so its files (for example core/docs/changelog.txt) are never served as static files — requests fall through to MODX and get a 404:
url.rewrite-once = (
"^/(assets|manager|connectors|\.well-known)(.*)$" => "/$1/$2",
"^/(?!index\.php)(.*)\?(.*)$" => "/index.php?q=$1&$2",
"^/(?!index\.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|connectors|media). Add |robots\.txt|/favicon\.ico to the same pattern if those files live in the document root and should be served directly.
These rules target lighttpd 1.4.x, which matches the full request URI including the query string.
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










