[pmwiki-users] clean URLs for wikifarm in subdirectory

Hans design at flutesong.net
Tue Mar 15 12:30:37 CST 2005


Tuesday, March 15, 2005, 5:15:51 PM, Bronwyn wrote:
> I'm migrating and splitting a v1 wiki into a v2 farm with 2 fields.  I
> want to use clean URLs for them, but I can't figure out how.  The
> directory structure is this:

> webserver
> - static (for some static HTML content)
> - pmwiki (to hold all pmwiki stuff)
> -- wikifarm
> -- bliki
> -- portfolio

> Currently the urls look like this:
> Bliki:
> http://arndis.godsong.org/pmwiki/bliki/field.php/PmWiki/TipsForEditing
> Portfolio:
> http://arndis.godsong.org/pmwiki/portfolio/field.php/PmWiki/TipsForEditing

> My goal is to remove the /pmwiki/ and field.php from the URLs, so that
> they look like this:

> Bliki: http://arndis.godsong.org/bliki/PmWiki/TipsForEditing
> Portfolio: http://arndis.godsong.org/portfolio/PmWiki/TipsForEditing

Here is my preferred solution:
Create text files without file-extension in the site root
(public_html/) (create normal text file first, then rename it)
for each field with a name which will be the
part of the root name for the fields pages, i.e. bliki, portfolio.
The content for file "bliki":
<?php chdir("pmwiki/bliki"); include("../pmwiki/wikifarm/pmwiki.php"); ?>
The content for file "portfolio":
<?php chdir("pmwiki/portfolio"); include("../pmwiki/wikifarm/pmwiki.php"); ?>

Create a .htaccess file in the site root (create a text file and rename)
with content:
<Files bliki>
SetHandler application/x-httpd-php
</Files>
<Files portfolio>
SetHandler application/x-httpd-php
</Files>

This declares the named files as being php files, without them needing
a .php extension.

In wikifarm/local/farmconfig.php set
$FarmPubDirUrl = 'http://arndis.godsong.org/pmwiki/wikifarm/pub';
$EnablePathInfo = 1;

In bliki/local/config.php  set
$ScriptUrl = 'http://arndis.godsong.org/bliki';

and in portfolio/local/config.php set
$ScriptUrl = 'http://arndis.godsong.org/portfolio';

This points to the fields "run.php" file, i.e. the one with the
include("../pmwiki/wikifarm/pmwiki.php") statement.

That should do it.
Best,
~Hans                           




More information about the pmwiki-users mailing list