OpenUrls

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

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

See Also

Contributors

Comments

See discussion at OpenUrls-Talk


User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.