lighttpd 1.4.x
https://www.lighttpd.net/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.0 KiB
80 lines
2.0 KiB
============ |
|
URL Rewrites |
|
============ |
|
|
|
------------------- |
|
Module: mod_rewrite |
|
------------------- |
|
|
|
:Author: Jan Kneschke |
|
:Date: $Date: 2004/11/03 22:26:05 $ |
|
:Revision: $Revision: 1.2 $ |
|
|
|
:abstract: |
|
url rewrite |
|
|
|
.. meta:: |
|
:keywords: lighttpd, rewrite |
|
|
|
.. contents:: Table of Contents |
|
|
|
Description |
|
=========== |
|
|
|
internal redirects, url rewrite |
|
|
|
Options |
|
======= |
|
|
|
url.rewrite-once |
|
rewrites a set of URLs interally in the webserver BEFORE they are handled. |
|
|
|
e.g. :: |
|
|
|
url.rewrite-once = ( "<regex>" => "<relative-uri>" ) |
|
|
|
url.rewrite-repeat |
|
rewrites a set of URLs interally in the webserver BEFORE they are handled |
|
|
|
e.g. :: |
|
|
|
url.rewrite-repeat = ( "<regex>" => "<relative-uri>" ) |
|
|
|
The options ``url.rewrite`` and ``url.rewrite-final`` were mapped to ``url.rewrite-once`` |
|
in 1.3.16. |
|
|
|
Examples |
|
======== |
|
|
|
The regex is matching the full REQUEST_URI which is supplied by the user including |
|
query-string.:: |
|
|
|
url.rewrite-once = ( "^/id/([0-9]+)$" => "/index.php?id=$1", |
|
"^/link/([a-zA-Z]+)" => "/index.php?link=$1" ) |
|
|
|
|
|
# request: http://www.domain.com/url/ |
|
# or request: http://any.domain.com/url/ |
|
# before write: /www/htdocs/url/ |
|
# after rewrite: /www/htdocs/domain.com/url/ |
|
# document-root=/www/htdocs/ %0=www.domain.com $1=url/ |
|
server.document-root = "/www/htdocs/" |
|
$HTTP["host"] =~ "^.*\.([^.]+\.com)$" { |
|
url.rewrite-once = ( "^/(.*)" => "/%0/$1" ) |
|
} |
|
|
|
|
|
# request: http://abc.mass-serve-subdomain.com/url/ |
|
# before rewrite: /www/htdocs/url/ |
|
# after rewrite: /www/htdocs/mass-serve-subdomain.com/abc/url/ |
|
$HTTP["host"] =~ "^([^.]+)\.mass-subdomain\.com" { |
|
server.document-root = "/www/htdocs/mass-subdomain.com" |
|
url.rewrite-once = ( "^/(.*)" => "/%1/$1" ) |
|
} |
|
|
|
|
|
# similar effect as above, except that you have multiply mass-subdomain now |
|
server.document-root = "/www/htdocs/" |
|
$HTTP["host"] =~ "^([^.]+)\.(mass-subdomain\.com|mass-subdomain\.net)" { |
|
url.rewrite-once = ( "^/(.*)" => "/%2/%1/$1" ) |
|
}
|
|
|