"clean" page URLs with newLISP wiki
Posted: Sat Apr 12, 2008 5:51 pm
				
				Hi there,
I'm not a big fan of URLs of form
I'd rather have 
It took me 5 mins to get the newLISP wiki to use this form of URLs together with Apache and mod_rewrite.
I used following configuration in httpd.conf (if you use .htaccess, you'd need to modify it a bit, but not much):
In index.cgi, I just removed references to "index.cgi?page=" in the URLs.
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
			I'm not a big fan of URLs of form
Code: Select all
http://www.example.com/index.cgi?page=PageCode: Select all
http://www.example.com/PageI 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