I wanted to use URLs without a QueryString? for normal page reads, while continuing to use QueryString?s for other actions. It was fairly straight-forward with Apache's mod_rewrite and some changes to UseMod.
These rewrite rules assume that /page is a ScriptAlias? (or attached to executing the wiki script in some other way, e.g. with SetHandler? inside <Location /page>).
Another place to modify is the default page on your wiki. On mine it is Home, which is why I send an external redirect for "/" pointing the browser to "/Home". This again helps with my log processing, as "/" does not get accounted for separately (since the wiki script would be returning the contents of the "Home" page anyway).
Finally, I also require all links to be capitalized (even FreeLinks), so I can just look at the first character of the URL to see that the request is for a wiki page. All other content (i.e. static pages, CSS files etc.) use lowercase names.
RewriteEngine On RewriteRule ^/$ /Home [L,R] RewriteRule ^/go$ /page [PT,L,QSA] RewriteRule ^/([A-Z].*)$ /page?$1 [PT,L]
The rules together with mod_perl configuration directives can be found here: ftp://ftp.gw.com/pub/people/kim/patches/usemod/url-rewrite.conf
The support in the wiki script includes two configuration variables:
Leaving either variable empty will use the current default, i.e. auto-detect the name of the script and use it for all requests.
The patch is here: ftp://ftp.gw.com/pub/people/kim/patches/usemod/url-rewrite.diff
/ => /wiki.pl /MyPage => /wiki.pl?id=MyPage /MyPage/SubPage => /wiki.pl?id=MyPage/SubPage /MyPage?action=edit => /wiki.pl?id=MyPage&action=edit /aDirectory/ => /aDirectory/ (if it exists) /images/myimage.png => /images/myimage.png (if it exists)/wiki/.htaccess
# Set the default page to the wiki DirectoryIndex wiki.pl # URL rewriting for clean URLs RewriteEngine On # Set this to the base directory of your wiki (eg www.example.org/wiki/wiki.pl = /wiki/) RewriteBase /wiki/ # Don't rewrite requests for any files, directories, or symbolic # links (shortcuts) that exist on the filesystem. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l # Send requests to wiki.pl, appending the query string part. RewriteRule ^([^/a-z].*) wiki.pl?id=$1 [QSA,L]-- AndrewFyfe?