[pmwiki-users] I need help with clean URLs

info at theburroughsproject.com info at theburroughsproject.com
Sun Aug 13 23:58:12 CDT 2006

Hello again. I've talked with tech support at godaddy.com, and they
claim that the mod_rewrite should work for what I'm doing, and have
assured me that there are no restrictions to mod_rewrite whatsoever. So
I just wanted to check with you one last time, to make absolutely sure
that I'm doing this correctly. This is what I'm doing:

In my root document folder I have only two items: one folder named
"pmwiki", and one .htaccess  
file. This is an exact copy of what's in my .htaccess file:

# Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
RewriteEngine On
# The rewrite base will be the document root.
RewriteBase /
# Send requests without parameters to pmwiki.php.
RewriteRule ^$           pmwiki/pmwiki.php  [L]
# Send requests for index.php to pmwiki.php.
RewriteRule ^index\.php$ pmwiki/pmwiki.php  [L]
# Send requests to pmwiki.php, appending the query string part.
RewriteRule ^([^/a-z].*) pmwiki/pmwiki.php?n=$1  [QSA,L]

And this is an exact copy (except the word "example") of what's in my
config file, which is located at /pmwiki/local/config.php:

<?php if (!defined('PmWiki')) exit();
## Use "Clean URLs".
$EnablePathInfo = 1;
$ScriptUrl = "http://www.example.com";
## more configuration settings...

The results are that Main.HomePage appears at www.example.com, that
works fine - and all of the links now point to clean URLs (like
"www.example.com/SomeGroup/SomePage"), but I get a 404 error on them.

I'm using a completely clean installation of pmwiki-2.1.12. Other than
adding the config file and the .htaccess file, the installation is %100
straight out of the box. The .htaccess file is definitely "functioning",
meaning that the changes I make to it have an immediate effect. I'm
hoping that there is something wrong with the above, because if it's
not, then I'm pretty much out of ideas.

Thanks for everything,


-------- Original Message --------
Subject: Re: [pmwiki-users] I need help with clean URLs
From: "Patrick R. Michaud" <pmichaud at pobox.com>
Date: Sat, August 12, 2006 4:36 pm
To: "H. Fox" <haganfox at users.sourceforge.net>
Cc: info at theburroughsproject.com, pmwiki-users at pmichaud.com

On Sat, Aug 12, 2006 at 03:57:18PM -0700, H. Fox wrote:
> On 8/12/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> >On Fri, Aug 11, 2006 at 11:57:29PM -0700, info at theburroughsproject.com 
> >wrote:
> >> Right now my URLs look like this:
> >> www.example.com/pmwiki.php?n=SomeGroup.SomePage
> >>
> >> I want my URLs to look like this:
> >> www.example.com/SomeGroup/SomePage
> >
> >This looks like "Example Three" from the Cookbook.CleanUrls
> >page, so you'll want to follow it.
> Ironically it's more a lot like (more like?) Example One, ".htaccess
> and pmwiki.php in the Same Directory".

Hmmm.  I was thinking it was more like Example Three, because
Example One says:

  After: http://www.example.com/~someuser/pmwiki/Main/HomePage

while Example Three says

  After: http://www.example.com/Main/HomePage

which is obviously a lot closer to what the original poster wanted.
This is a bit reinforced in the list of examples above where it says

      Example One:  http://www.example.com/~someuser/pmwiki/.htaccess
      Example Two:  http://www.example.com/~someuser/.htaccess
    Example Three:  http://www.example.com/.htaccess

where again Example Three appeared closest to desired ultimate result.

> Putting it this way is likely to be confusing for others who might be
> searching the archives.
> The .htaccess file goes in the directory that will be requested, not
> the directory that holds pmwiki.php.  In this instance they happen to
> be the same.

A very valid point -- in describing this particular example it
was simpler to describe it as relative to pmwiki.php, but in
general it's much more correct to say it should go in the directory
of the request.

> When it came time to improve on ~someuser, other alternatives seemed
> even less appealing.  :-|  In the end I just stuck with ~someuser
> because I thought it might actually help experienced administrators
> ("oh I see, it could be installed in a user directory").  This seemed
> worth trading off some possible confusion for an administrator who's
> unfamiliar with user directories.  Using ~someuser could also help
> clarify the difference between "URL paths" and the "filesystem paths".
> We can go ahead and try "just using 'path/to/pmwiki'" instead.  I
> predict that will add confusion, not reduce it.

I totally agree, it still has a lot of potential for (adding) confusing.
I'm just thinking that the case of installing PmWiki into a hosted
environment (sans ~username) is a *lot* more common than using

> [snip]
> >Your questions have already pointed out some important gaps
> >in the current documentation, so this is a huge help to us all.
> I'm disappointed to learn that I spent those hours rewriting the
> CleanURLs recipe page only to leave holes and huge gaps.  

Please don't be disappointed; I wasn't intending to imply there
are huge gaps in CleanUrls, my implication was more that the
page has evolved to the point where it requires more specific/
penetrating questions in order to see where potential confusion
lies.  I think that the current CleanUrls page is a huge success,
especially as evidenced by how few questions we now get on the
mailing list about the topic.

> IMHO part of
> the problem here was that the poster installed PmWiki in the web
> docroot directory, which is not necessary and probably not
> advisable.[1]

I thought the same thing at the time of my reply but didn't write it --
preferring to remain focused on the immediate issue.  I totally
agree that it's probably better to install PmWiki in a pmwiki/
subdirectory somewhere, and then use mod_rewrite to make the
urls appear at the server root, for the same reasons you cite
in the CleanUrls note that was added.


More information about the pmwiki-users mailing list