[pmwiki-users] Clean URLs - how to make them even shorter?

Patrick R. Michaud pmichaud at pobox.com
Sun Jan 30 11:23:20 CST 2005


On Sun, Jan 30, 2005 at 12:01:42PM -0500, Matt Simpson wrote:
> In the http://www.pmwiki.org/wiki/Cookbook/CleanUrls example, 
> how would one eliminate the /pmwiki/ or modify the /pmwiki/ 
> within the URL to show something else?
> 
> In my case, the example matches perfectly up to this point.  
> I create an .htaccess with this content...
> 
> RewriteEngine on
> RewriteRule ^([A-Z].*) /pmwiki/pmwiki.php?n=$1 [L,qsappend]
> RewriteRule ^$ /pmwiki/pmwiki.php [L,qsappend]

Just move your .htaccess file up one level to the directory that
corresponds to your url "root".  Then urls like

    http://undertheoak.net/Main/HomePage

will be correctly forwarded to /pmwiki/pmwiki.php?n=Main/HomePage

You'll still want to have variable settings in your config.php:

## for clean URL
  $EnablePathInfo = 1;
  $ScriptUrl = 'http://undertheoak.net';
  $PubDirUrl = 'http://undertheoak.net/pmwiki/pub/';
  $UploadUrlFmt = 'http://undertheoak.net/pmwiki/uploads';

----

If you're wanting to preserve the 'wiki/Main/HomePage' syntax, you
can either use aliases as before, or just rename the pmwiki/ subdirectory
to wiki/ and update the RewriteRules and variables to use 'wiki' instead
of 'pmwiki':

## wiki/.htaccess
RewriteEngine on
RewriteRule ^([A-Z].*) /wiki/pmwiki.php?n=$1 [L,qsappend]
RewriteRule ^$ /wiki/pmwiki.php [L,qsappend]

## for clean URL
  $EnablePathInfo = 1;
  $ScriptUrl = 'http://undertheoak.net/wiki';
  $PubDirUrl = 'http://undertheoak.net/wiki/pub/';
  $UploadUrlFmt = 'http://undertheoak.net/wiki/uploads';

Pm



More information about the pmwiki-users mailing list