Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

OpenUrls

Summary: Automatically create URL Path for use with EnablePathInfo.
Version: 1.0
Maintainer: BenWilson
Categories: WikiFarms, PageNaming

Question

I don't want to type the URL path to the script for every field I have in my wiki farm. How do I create Clean Urls automatically?

Answer

Open Urls is a take off of the name for OpenBSD and OpenSSH, neither of which are open. The purpose of this script is to automatically create a clean url for $ScriptUrl without having to manually edit each time. Set either of the two variables below (before the script is included), include the script, and your URLs will be set without index.php or pmwiki.php. It will also prepend the "https:" protocol to help force SSL protection for your pages.

You will need the following in your .htaccess, with an appropriate configuration in Apache:

 RewriteRule ^([A-Z].*) index.php?n=$1 [L,qsappend]
 RewriteRule ^$ index.php [L,qsappend]

or

 RewriteRule ^([A-Z].*) pmwiki.php?n=$1 [L,qsappend]
 RewriteRule ^$ pmwiki.php [L,qsappend]

Providing the root directory for the wiki has no capital letters then the above mentioned redirect will behave as Pmwiki does.

Attach: openurl-0.1.phpΔ

Notes

  • $EnableOpenUrl (default 0) When set, this variable will tell Open Urls to create $ScriptUrl without 'index.php' or 'pmwiki.php.'
  • $EnableOpenUrlSecure (default 0) Behaves the same as $EnableOpenUrl, except it will also convert 'http:' to 'https:' forcing security.
  • This recipe was last tested on PmWiki version: 2.0.6 through 2.0.12
  • This recipe requires at least PmWiki version: Should work for all 2.0 series, but notice the versions upon which it was tested.

Releases

  • 0.1 Initially released - 2005-OCT-23

Comments

Working on pmwiki-2.1.3: Well, I couldn't use the default configuration for mod_rewrite, I don't know why it doesn't worked. So, here it's what I did: First, created an .htaccess file and uploaded it to my default wiki directory. This wasn't my root server dir.

<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^([A-Z].*) pmwiki.php?n=$1 [L,qsappend] RewriteRule ^$ pmwiki.php [L,qsappend] </IfModule>

Then, edited this part on the config.php file in my /pmwiki/local/ directory. Replace the . with your actual server.

$ScriptUrl = './wp-wiki';

Last, edited the openurl-0.1.php to allow the rewrite, and that was it! I wrote this because there weren't clear instructions on how to do this, so I had to guess. Good luck! Stahn(03-23-06)

See Also

Contributors


Edit - History - Print - Recent Changes - Search
Page last modified on May 18, 2007, at 11:22 AM