pmwiki.php
script itself. The examples below assume that a URL such as http://www.example.com/wiki is being set to refer to pmwiki.php on the www.example.com website.
There are four basic ways to accomplish this: aliasing, making a "wiki" script, renaming the pmwiki script, or using mod_rewrite.
Alias /wiki /path/to/pmwiki.phpto the configuration file will perform the alias for you. In some cases (for instance Apache 2.0) you might be forced to use the full path to pmwiki.php, i.e.
Alias /wiki /home/account/www/pmwiki.phpeven when you've already defined the documentroot as /home/account/www. You'll then need to set
$PubDirUrl
and $UploadsUrlFmt variables in config.php to point to the correct urls for your pub/
and uploads/
directories.
Added by heck@fas.harvard.edu: Using Apache 2.0.x, I also needed to alias the pub directory. The link tags that load the style sheets will now point at e.g. http://example.com/wiki/pub/css/stdlayout.css, but that is aliased to /home/account/www/pmwiki.php/pub/css/stdlayout.css, which makes no sense. The solution is to add another alias:
Alias /wiki/pub /home/account/www/pubNote that you can put these directories anywhere: They do not have to be under your DocumentRoot. NOTE (added be tj-AT-web62.com): Tis did not work for me, donīt know why. If I did it like above, the second Alias just triggered a request to the wiki error message 'pub/skins/pmwiki/pmwiki.css' is not a valid PmWiki page name I had to add an Alias /pub /home/account/www/pub to get it work right! It seems that all steps described below only make sense, if in the configuration file of the webserver "AllowOverride None" not is set. All user specific directives are forbidden this way. So what then?? (fhattop@yahoo.de)
wiki
file:
<?php chdir("/path/to/pmwikidir"); include("pmwiki.php"); ?>In the script, replace
/path/to/pmwikidir
with the name of the directory containing pmwiki.php
. Then, add the following lines to the .htaccess
file in the same directory as the wiki
file (create the .htaccess
file if doesn't exist):
<Files wiki> SetHandler application/x-httpd-php </Files>This tells the webserver to treat the
wiki
file as a PHP script even though it doesn't end in .php
. Now, requests for your wiki
file will cause the web server to change to the directory containing pmwiki.php
and execute it from there. Make sure $ScriptUrl
in config.php
is pointing at the wiki
file, and not at the directory containing pmwiki.php
.
.htaccess
file in the pmwiki directory:
DirectoryIndex pmwiki.phpThis causes pmwiki.php to be loaded by default instead of index.php or index.html, and obscures the filename, at least for first-time visitors.
RewriteEngine on RewriteBase / RewriteRule ^([A-Z].*) /path/to/pmwiki/pmwiki.php?pagename=$1 [L,qsappend]When using mod_rewrite make sure you have all the following set in your local/config.php
$ScriptUrl = 'http://yourdomain.com/dir/pmwiki.php'; $PageUrlFmt = 'http://yourdomain.com/$Group/$Title_'; $PubDirUrl = 'http://yourdomain.com/dir/pub'; $UploadUrlFmt = 'http://yourdomain.com/dir/uploads';
$ScriptUrl
to the pseudo-path you set up, without a trailing slash, will make things look really nice. For instance, the above mod_rewrite commands combined with
$ScriptUrl = "http://wiki.example.com";in config.php would result a URL that looks like this:
http://wiki.example.com/Main/HomePage/