rewrite.txt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ============
  2. URL Rewrites
  3. ============
  4. -------------------
  5. Module: mod_rewrite
  6. -------------------
  7. :Author: Jan Kneschke
  8. :Date: $Date: 2004/11/03 22:26:05 $
  9. :Revision: $Revision: 1.2 $
  10. :abstract:
  11. url rewrite
  12. .. meta::
  13. :keywords: lighttpd, rewrite
  14. .. contents:: Table of Contents
  15. Description
  16. ===========
  17. internal redirects, url rewrite
  18. Options
  19. =======
  20. url.rewrite-once
  21. rewrites a set of URLs internally in the webserver BEFORE they are handled.
  22. e.g. ::
  23. url.rewrite-once = ( "<regex>" => "<relative-uri>" )
  24. url.rewrite-repeat
  25. rewrites a set of URLs internally in the webserver BEFORE they are handled
  26. e.g. ::
  27. url.rewrite-repeat = ( "<regex>" => "<relative-uri>" )
  28. The options ``url.rewrite`` and ``url.rewrite-final`` were mapped to ``url.rewrite-once``
  29. in 1.3.16.
  30. Warning
  31. =======
  32. Do NOT use mod_rewrite to protect specific urls, as the original url passed from the client
  33. is matched against your rules, for example strings like "/abc/../xyz%2f/path".
  34. Examples
  35. ========
  36. The regex is matching the full REQUEST_URI which is supplied by the user including
  37. query-string.::
  38. url.rewrite-once = ( "^/id/([0-9]+)$" => "/index.php?id=$1",
  39. "^/link/([a-zA-Z]+)" => "/index.php?link=$1" )
  40. # the following example, is, however just simulating vhost by rewrite
  41. # * you can never change document-root by mod_rewrite
  42. # use mod_*host instead to make real mass-vhost
  43. # request: http://any.domain.com/url/
  44. # before rewrite: REQUEST_URI="/www/htdocs/url/"
  45. # and DOCUMENT_ROOT="/www/htdocs/" %0="www.domain.com" $1="url/"
  46. # after rewrite: REQUEST_URI="/www/htdocs/domain.com/url/"
  47. # still, you have DOCUMENT_ROOT=/www/htdocs/
  48. server.document-root = "/www/htdocs/"
  49. $HTTP["host"] =~ "^.*\.([^.]+\.com)$" {
  50. url.rewrite-once = ( "^/(.*)" => "/%0/$1" )
  51. }