Markup: rst Description: Pagegen user experience and SEO may be increased by configuring the web server appropriately. All necessary files for a freshly generated site are found in the ``site`` directory. To publish the site, this directory must be uploaded to the web server. The site will work out of the box if sane settings are used, but a little configuration of the web server can make the site more friendly to humans and crawlers. .. tip:: All links generated by Pagegen are by default relative and assume the site is located directly on the web root folder (e.g. http://mysite.com/). If the site is to be in any other location the ``base_url`` setting in ``site.conf`` must be set accordingly and ensure that ``absolute_urls`` setting is removed. .. tip:: If using Apache the .htaccess file can be saved as a normal page in the ``content directory``. Most likely the headers should be: ``Generate html: False``, ``Menu exclude: True`` and ``Sitemap exclude: True`` The following settings may be set in different configuration files depending on the web server setup, exactly where to put them is outside the scope of this article, but with the setting names and Google you should be on your way. Nice URLs ********* File name extensions are optional to Pagegen, however if they are not used the web server must be configured to serve extensionless files with the correct mime type. The configuration below tells the web server to set the HTTP *Content-Type* header to *text/html* for all files, except if the file has an extension, in which case use default mime type. Apache ====== :: # Force text/html for all files ForceType text/html # Use default type for files that have an extension ForceType none Nginx ===== :: default_type text/html; Serve default file ****************** If no file specified in request, as happens when accessing a directory on the web site, it is nice if the web server returns a default file, instead of a directory listing (which can be the default). Content files for directories are ``index`` (with optional extension), the web server should serve the ``index`` file when the user requests a directory. Apache ====== :: DirectoryIndex index.html Nginx ===== :: index index.html; Custom error pages ****************** On an error web servers can be configured to serve custom error pages (e.g a 404 if a file was not found). Error pages content can be handled by Pagegen if required, but the web server needs to be told where to find them. Error pages for the following types could be a fair starting point. * 403 - Access forbidden * 404 - Page not found * 500 - Internal server error Create the following files with appropriate content. * content/403.html * content/404.html * content/500.html Example 404 page ================ :: Title: Page not found Menu title: 404 Sitemap exclude: True Menu exclude: True Link chain exclude: True Search index exclude: True Preserve file name: True Sorry, couldn't find that page:( Apache ====== :: ErrorDocument 403 /403.html ErrorDocument 404 /404.html ErrorDocument 500 /500.html Nginx ===== :: error_page 403 /403.html; error_page 404 /404.html; error_page 500 /500.html; Serve compressed content ************************ For performance content suitable for compression (e.g. text, not images) should be gzipped. Consider also doing this with a hook script, to save the web server gzipping every file it sends. Apache ====== :: SetOutputFilter DEFLATE AddOutputFilterByType DEFLATE text/plain text/html application/javascript text/javascript application/x-javascript text/css Nginx ===== :: gzip on; gzip_types text/plain text/html application/javascript text/javascript application/x-javascript text/css;