Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Automatic generation of destination files
Gustav provides an auto-generation feature. Auto-generating destination files works by using a PHP file generating the destination file upon the requested URL as the 404 error document in the destination directory and its subdirectories to be called when a non-existing destination file is requested.
##Choosing a matching source file
Picking a matching source file works as described below. If no matching source file could be found, a Gustav-error is thrown.
generator_search_recursiveconfiguration option is set to
true, all subdirectories of the source directory are searched for matching source files.
Otherwise, The directory to be searched is chosen by using the dirname of the requested URL's path. If that path's last path segment is
index.htmland is not followed by a directory separator, the next upper directory is used instead.
The chosen directory or, if the
generator_search_recursiveconfiguration option is enabled, the source directory and all of its subdirectories are scanned for matching source files (including disabled source files ond those that are located in a
A source file matches if it matches
destfilter set to the path described by the URL (relative to the document root).
If a source file whose destination path matches exactly the requested one is found, regardless of whether it's [disabled(Disabled-source-files) or not, all matching source files whose destination path doesn't match exactly the requested one are removed from the list of matching source files.
Disabled source files are filtered out of the remaining matching source files.
The remaining matching source files are sorted by the following rules (important to less important):
The best matching source file is used.
##Creating the destination file
If the destination file couldn't have been created, a Gustav-error is thrown.
Otherwise the user is redirected to the created destination file. A query string included in the URL of the original request is passed through to the redirect URL.