
The URL toolkit is a set of tools to perform actions based on the URL or on the URL itself. Regular expressions are used to find a matching URL. Possible actions for matching URLs are rewriting the URL, denying access or redirecting to another URL.
The most important feature of the URL toolkit is URL rewriting. Via URL rewriting, the URL can be changed into another URL before Hiawatha handles it. The following example leaves URLs that matches an existing file or files in the images directory unchanged, denies access to files in the data directory and rewrites all other URLs to /index.php.
UrlToolkit {
ToolkitID = rewrite
RequestURI exists Return
Match ^/images Return
Match ^/data DenyAccess
Match /(.*) Rewrite /index.php?page=$1
}
VirtualHost {
Hostname = www.domain.com
...
UseToolkit = rewrite
}
The complete syntax of the URL toolkit in Hiawatha is:
UrlToolkit {
ToolkitID = <toolkit_id>
Call <rewrite_id>
Header <key> [!]<value> Call|DenyAccess|Exit|Goto|Return|Skip|Use
Match [!]<url> Ban|Call|DenyAccess|Exit|Expire|Goto|Return|Rewrite|Redirect|Skip|UseFastCGI
Method [!]<request method> Call|DenyAccess|Exit|Goto|Redirect|Return|Skip|Use
RequestURI exists|isfile|isdir Return|Exit
Skip <lines>
UseSSL Call|Exit|Goto|Return|Skip
}
The format of the actions is as follows:
Ban <seconds>
Call <toolkit_id>
DenyAccess
Exit
Expire <number> (seconds|minutes|hours|days|weeks|months) [Public|Private] [Return|Exit]
Goto <toolkit_id>
Redirect <url>
Return
Rewrite <replace> [<max_loop>] [Continue|Return]
Skip <lines>
Use <url>
UseFastCGI <fastcgi_server_id>
Explanation of the commands:
wigwam -t <toolkit_id>