[pmwiki-users] The return of CleanUrls

Joachim Durchholz jo at durchholz.org
Mon Feb 27 07:25:36 CST 2006


Dominique Faure schrieb:
> 
> Create a file name "wiki" and containing enough code to bootstrap your
> wiki as in:
> 
>   <?php chdir('pmwiki'); include_once('pmwiki.php');

The 'chdir' call is an additional tweak beyond what the CleanUrls recipe 
does.
The advantage is that you can pack the PmWiki installation into a 
subdirectory - great if you have other things that live in the directory.
The disadvantage is that you'd have to set PubDirUrl and others to 
include that additional pmwiki/ component in the URL path. In other 
words, chdir() will make path autodetection work on a smaller number of 
servers. (That's why I didn't mention it when I rewrote the CleanUrls 
page - given that PmWiki doesn't place too many things in the 
installation directory, I thought it more acceptable to live directly in 
the installation directory.)

> and provide following directives into a @@.htaccess@@ file in the same
> directory:
> 
>   <FilesMatch "^wiki$">
>     ForceType application/x-httpd-php
>   <FilesMatch>

Note that this will *not* work everywhere. It will only work on servers 
where the PHP was configured to be run for files with a MIME type of 
application/x-httpd-php.

I'm not 100% sure, but IIRC this means that this configuration is 
restricted to those that run via mod_php. (Don't say it's the standard 
setup anyway - it is now, but web hosters have begun considering moving 
to FastCGI, because mod_php is too restrictive with Safe Mode and too 
unsafe without Safe Mode. Besides, php-fcgi adds the option to offer 
PHP4 alongside with PHP5.)

On boxes that use php-fcgi, the MIME type for PHP can be *anything*. The 
MIME type for script files is never sent to the browser, it's just a 
name that Apache uses to tie the file type declarations (AddType or 
ForceType) to the script engine (Action). It is even a marginally good 
idea to use a type name that isn't valid syntax for a MIME type, since 
then it's impossible to have a collision with a real MIME type.

If you really want a "wiki" prefix, it's probably better to enable 
content negotiation, and drop a file names "wiki.php". If the server 
sees a request for "wiki", it will then look for "wiki.*" to find the 
file to serve.

NOTE: If you want a /wiki/ component in the path, it's even easier to 
create a subdirectory called wiki, install PmWiki into it, and then 
proceed with the normal CleanUrls recipe.


In general, while I appreciate the multitude of possibilities to get 
CleanUrls to run, I suggest sticking with a few known-to-work ones.
Currently, CleanUrls offers a bewildering array of variants; what's 
missing is a list of criteria that help choose the right one, not adding 
yet another variant.

Regards,
Jo




More information about the pmwiki-users mailing list