URI redirection (2)
目次
Location
$web/etc/rewrite
Description
This file is used to give valid URI to the client.URI redirection takes two steps. The first is by
/sys/lib/httpd.rewrite and the second is by $web/etc/rewrite. The former is managed by the server administrator and the latter, by the document administrator.
The first field is a path from document root, therefore
- first field begins with "
/"
- first field cannot begin with "
/~"
scheme://hostdom[:port][/path][;params][?query]
/path[;params][?query]
[ ] is meta symbol that denote inside of these symbol can be omitted andscheme ::any scheme
hostdom ::full name of host (pegasus.goodwill.comfor example)
port ::port number
path ::path to document
params ::argument list for CGI
query ::query string
Redirection loop
Let's consider about/private https://pegasus.goodwill.com/privatethat appeared in case study of
/sys/lib/httpd.rewrite.Why
bob wrote such a line? He wanted to use https for /private.Request will come at first time with
http://pegasus.goodwill.com/private. The request will then be redirected to https://pegasus.goodwill.com/private. The client will make a second request https://pegasus.goodwill.com/private. What will happen then?If server redirects the request to
https://pegasus.goodwill.com/private, then the redirection will fall into infinite loop! Therefore Pegasus does not redirect the request and simply accept as a request of this URI.The expression of redirection loop is allowed only in
$web/etc/rewrite, not in /sys/lib/httpd.rewrite. And the loop must be closed in a single line.