![]() |
![]() |
2006/08/23 Update
$web/etc/rewrite
This file is used to redirect a requested URI to other URI.
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
/"/~"The format allowed in second field is one of:
scheme://hostdom[:port][/path][;params][?query]/path[;params][?query]where [ ] is meta symbol that denotes inside of these symbol can be omitted and
scheme :: any schemehostdom :: full name of host (pegasus.goodwill.com for example)port :: port numberpath :: path to documentparams :: argument list for CGIquery :: query stringThe matched portion is replaced by the string of second field. See also path matching.
Let's consider about
/private https://pegasus.goodwill.com/private
that 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.