Content

Web server setup

After Pagegen has generated the site, all necessary files are found in the [site directory]/site/live directory. To publish, this directory must be copied to the web server.

All links generated by Pagegen are relative and assume the site is located directly on the web root folder (i.e. http://mysite.com/pagegen files). If this is no good, consider adding an appropriate <base> tag http://www.w3schools.com/TAGS/tag_base.asp to the [site directory]/templates/header file.

If using Apache the .htaccess file can be saved in the directory/templates directory, on generation it will be detected and copied to the web root folder. This allows both config and content to be saved locally and easily version controlled.

Force correct mime type

To provide SEO friendly URLs Pagegen does not add file extensions to the files it generates, therefore it is necessary for the web server to tell the browsers what content type the file is.

To do this for Apache add the following to your configuration (e.g. .htaccess).

 # Force text/html for all files
 <FilesMatch ".*">
   ForceType text/html
 </FilesMatch>

 # Use default type for files that have an extension
 <FilesMatch ".[a-zA-Z0-9]{1,4}$">
   ForceType none
 </FilesMatch>

The above Apache configuration tells Apache to set the HTTP Content-Type header to text/html for all files, exept if the file has an extension, in wich case do not force the type.

Serve default file if no file specified in request

Content files for directories are named default, for these to be returned when the user requests a directory the server must be configured.

For Apache this means setting the DirectoryIndex in the appropriate configuration file (e.g. .htaccess).

 DirectoryIndex default

Custom error pages

Pagegen automatically creates default error pages that the web server can be configured to show (if, for instance, a file was not found). The templates for the error pages can be found in the [site directory]/templates directory. The defaults templates are:

If other error pages are required, put them in the template directory and prefixing the file name with error_page_

The error pages are placed in [site directory]/site/live. The web server must be configured to show them if an error occurs.

For Apache the following will specify which error page to show. Add the following to the appropriate configuration file (e.g. .htaccess).

 ErrorDocument 400 /error_page_400
 ErrorDocument 403 /error_page_403
 ErrorDocument 404 /error_page_404
 ErrorDocument 500 /error_page_500
Last changed 2010-11-12 16:36