WikklyText A wikitext server and rendering library


files/feed-icon-14x14.png Recently Edited Valid XHTML 1.0 Strict
Apache+CGI+mod_rewrite edit
frank, 26 September 2009 (created 22 September 2009)
Tags: apache cgi server
Please read before continuing
  • These instructions are for WikklyText 1.9.x. If you are running an earlier version, see BehindApache instead.
  • If you are upgrading from WikklyText 1.6.x or earlier, you can delete the file wikboot.py in your wiki folder. It is no longer used.
For this example, I'll assume you are using the following locations. Adjust as needed:
Wiki filesystem location
/var/www/wikis/mywiki
Public URL
http://example.com/my/wiki

Notice two things here that are different from the basic CGI setup:
  • The public URL has nothing to do with the filesystem path.
  • The actual CGI filename is hidden.

Basic CGI Setup


First of all, get a basic CGI setup working using Apache+CGI. We will build on top of that setup below.

Add mod_rewrite


In your Apache configuration file, add a new section (leaving everything else as-is):
<Location /my/wiki>
    # redirect /my/wiki -> /wikis/mywiki/wiki.py
    RewriteEngine on
    RewriteBase /my/wiki
    # don't change if already rewritten
    RewriteCond %{REQUEST_URI} !wiki.py
    RewriteRule /my/wiki/(.*)$ /wikis/mywiki/wiki.py/$1
</Location>


Modify CGI script


Change the SCRIPT_NAME parameter in your CGI file:

/var/www/wikis/mywiki/wiki.py
SCRIPT_NAME = '/my/wiki'


Ready to go!


You should be able to browse your wiki at http://example.com/my/wiki