summaryrefslogtreecommitdiff
path: root/doc/rewrite.txt
blob: e46702232fda4815024119f6c7e2646d80efc291 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
============
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" )



  # 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

  # request:        http://any.domain.com/url/
  # 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/

  server.document-root = "/www/htdocs/"
  $HTTP["host"] =~ "^.*\.([^.]+\.com)$" {
    url.rewrite-once = ( "^/(.*)" => "/%0/$1" )
  }