I'm not a big fan of URLs of form
Code: Select all
http://www.example.com/index.cgi?page=Page
Code: Select all
http://www.example.com/Page
I used following configuration in httpd.conf (if you use .htaccess, you'd need to modify it a bit, but not much):
Code: Select all
<VirtualHost [...]>
[...]
RewriteEngine On
RewriteRule ^/$ %{DOCUMENT_ROOT}/index.cgi [L]
RewriteRule ^/index.cgi$ %{DOCUMENT_ROOT}/index.cgi [L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-l
RewriteRule ^/([a-zA-Z0-9\xa0-\xff].*)$ %{DOCUMENT_ROOT}/index.cgi?page=$1 [
QSA,L]
</VirtualHost>
The result can be seen at http://wiki.km.krot.org/.
Of course, this is a quick and dirty hack. A better way would be to check if the environment variable PATH_INFO exists and construct the URL depending on the fact of it's existance.
-- Kirill