You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.8 KiB
Plaintext
78 lines
1.8 KiB
Plaintext
19 years ago
|
============
|
||
|
URL Rewrites
|
||
|
============
|
||
|
|
||
|
-------------------
|
||
|
Module: mod_rewrite
|
||
|
-------------------
|
||
|
|
||
|
:Author: Jan Kneschke
|
||
|
:Date: $Date: 2004/11/03 22:26:05 $
|
||
|
:Revision: $Revision: 1.2 $
|
||
|
|
||
|
:abstract:
|
||
|
url rewrite
|
||
![]()
17 years ago
|
|
||
19 years ago
|
.. meta::
|
||
|
:keywords: lighttpd, rewrite
|
||
![]()
17 years ago
|
|
||
19 years ago
|
.. contents:: Table of Contents
|
||
|
|
||
|
Description
|
||
|
===========
|
||
|
|
||
|
internal redirects, url rewrite
|
||
|
|
||
|
Options
|
||
|
=======
|
||
|
|
||
18 years ago
|
url.rewrite-once
|
||
19 years ago
|
rewrites a set of URLs interally in the webserver BEFORE they are handled.
|
||
![]()
17 years ago
|
|
||
19 years ago
|
e.g. ::
|
||
![]()
17 years ago
|
|
||
18 years ago
|
url.rewrite-once = ( "<regex>" => "<relative-uri>" )
|
||
![]()
17 years ago
|
|
||
18 years ago
|
url.rewrite-repeat
|
||
19 years ago
|
rewrites a set of URLs interally in the webserver BEFORE they are handled
|
||
![]()
17 years ago
|
|
||
19 years ago
|
e.g. ::
|
||
![]()
17 years ago
|
|
||
18 years ago
|
url.rewrite-repeat = ( "<regex>" => "<relative-uri>" )
|
||
|
|
||
![]()
17 years ago
|
The options ``url.rewrite`` and ``url.rewrite-final`` were mapped to ``url.rewrite-once``
|
||
18 years ago
|
in 1.3.16.
|
||
|
|
||
15 years ago
|
Warning
|
||
|
=======
|
||
|
|
||
|
Do NOT use mod_rewrite to protect specific urls, as the original url passed from the client
|
||
|
is matched against your rules, for example strings like "/abc/../xyz%2f/path".
|
||
|
|
||
18 years ago
|
Examples
|
||
|
========
|
||
|
|
||
![]()
17 years ago
|
The regex is matching the full REQUEST_URI which is supplied by the user including
|
||
18 years ago
|
query-string.::
|
||
|
|
||
|
url.rewrite-once = ( "^/id/([0-9]+)$" => "/index.php?id=$1",
|
||
|
"^/link/([a-zA-Z]+)" => "/index.php?link=$1" )
|
||
18 years ago
|
|
||
18 years ago
|
|
||
|
|
||
18 years ago
|
# the following example, is, however just simulating vhost by rewrite
|
||
|
# * you can never change document-root by mod_rewrite
|
||
|
# use mod_*host instead to make real mass-vhost
|
||
18 years ago
|
|
||
![]()
17 years ago
|
# request: http://any.domain.com/url/
|
||
18 years ago
|
# before rewrite: REQUEST_URI="/www/htdocs/url/"
|
||
|
# and DOCUMENT_ROOT="/www/htdocs/" %0="www.domain.com" $1="url/"
|
||
|
# after rewrite: REQUEST_URI="/www/htdocs/domain.com/url/"
|
||
|
# still, you have DOCUMENT_ROOT=/www/htdocs/
|
||
18 years ago
|
|
||
|
server.document-root = "/www/htdocs/"
|
||
18 years ago
|
$HTTP["host"] =~ "^.*\.([^.]+\.com)$" {
|
||
|
url.rewrite-once = ( "^/(.*)" => "/%0/$1" )
|
||
18 years ago
|
}
|
||
18 years ago
|
|