[pmwiki-users] I need help with clean URLs
Patrick R. Michaud
pmichaud at pobox.com
Sat Aug 12 11:08:41 CDT 2006
On Fri, Aug 11, 2006 at 11:57:29PM -0700, info at theburroughsproject.com wrote:
> Hello. I'm having a very difficult time getting clean URLs. I have my
> pmwiki.php file and all of the folders in my main directory.
> Right now my URLs look like this:
> I want my URLs to look like this:
> And I'd like, if possible, for the Main.HomePage URL to just be:
This looks like "Example Three" from the Cookbook.CleanUrls
page, so you'll want to follow it.
First, let's get www.example.com/ to work for your Main.HomePage.
Create a file called 'index.php' in the same directory as pmwiki.php,
in that file place the line:
After doing this, then the url http://www.example.com/ should
automatically display the Main.HomePage.
Okay, now for the rest of the clean urls. Create a file called
'.htaccess' in the same directory as pmwiki.php, and in that
file include the following lines:
# Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
# The rewrite base will be the document root.
# Send requests without parameters to pmwiki.php.
RewriteRule ^$ pmwiki.php [L]
# Send requests for index.php to pmwiki.php.
RewriteRule ^index\.php$ pmwiki.php [L]
# Send requests to pmwiki.php, appending the query string part.
RewriteRule ^([^/a-z].*) pmwiki.php?n=$1 [QSA,L]
After making this change, urls that look like
www.example.com/SomeGroup/SomePage should work.
Lastly, we need to configure PmWiki to use the new "clean" urls
instead of its default, thus in local/config.php, place the lines
<?php if (!defined('PmWiki')) exit();
$EnablePathInfo = 1;
$ScriptUrl = 'http://www.example.com';
## remainder of configuration goes here
This will tell PmWiki to generate its links using the
www.example.com/SomeGroup/SomePage format instead of
> For example, whenever it mentions "~someuser", is that the same as
> saying "somefolder"? Or is there a significance with the "~" and the
> term "user"? What's a "user" in this context?
Aha, you've found a hole of sorts in the CleanUrls description.
CleanUrls was written from the perspective of someone having
installed PmWiki into a per-user directory on a server, where
urls all tend to begin with the user's name. But your situation
is running PmWiki from the document root directory, or from
a place that isn't associated with the server's user accounts.
In fact, I'd tend to think that your situation is the more common
So, perhaps what we need to do is to eliminate the "~someuser"
references and just use "path/to/pmwiki" instead, so that
the administrator understands to simply replace that component
of the path (without any reference to "~someuser").
Any comments from the group?
> And where it says:
> > Here's the matching local/config.php file:
> > <?php if (!defined('PmWiki')) exit();
> > ## Use "Clean URLs".
> > $EnablePathInfo = 1;
> > $ScriptUrl = "http://server.example.com/~someuser/pmwiki";
> > ## more configuration settings...
> what does the "server" in "server.example.com/~someuser/pmwiki";"
> supposed to be? Am I supposed to change that to something?
That's a typo in the recipe, it should match all of the other
server references --- i.e., it should also be "www.example.com".
> If someone could dumb this down for me, just give me a more "plain
> language" step-by-step that's not way over my head, I'd really
> appreciate it a lot. I've been trying different things for quite some
> time, and I just can't make it work. I don't know much about servers or
I hope the above is helpful -- if not, please keep asking.
Your questions have already pointed out some important gaps
in the current documentation, so this is a huge help to us all.
More information about the pmwiki-users