[pmwiki-users] Confused by redirection in .htaccess, EnableRedirect, PageUrl

Lucian Wischik lu.gmane at wischik.com
Sat Nov 11 13:23:26 CST 2006


I'm confused about redirection to do with CleanUrls.
For instance, I want each group's mainpage to be accessed
at http://www.com/Group rather than http:://www.com/Group/Group.
When I try this I get circular redirections...

.htaccess has uses mod_rewrite:
  RewriteRule ^(.*)$ pmwiki/pmwiki.php?n=$1 [QSA,L]
which means that http://www.com/Group will instead fetch
http://www.com/pmwiki/pmwiki.php?n=Group

The internals of pmwiki extract $group="Group" and $name="Group",
i.e. they deduce that we're talking about the page Group/Group.
Next I use PageUrl:

$FmtPV['$PageUrl'] = 'PUE($name==$group ?
   "$ScriptUrl/$group" : "$ScriptUrl/$group/$name")';

This means that pmwiki now believes the page url to be
  http://www.com/Group

But in stdconfig.php we call ResolvePageName which sees that
the pagename doesn't fit into the standard Group[/.]Name format.
And so it doesn't display the page, it instead emits a
"Redirect" page which redirects to http://www.com/Group/Group.
And when we get to Group/Group, the same thing happens with
$PageUrl and ResolvePageName, so it emits another "Redirect"
page. And so on.


What's the correct solution to this? (Maybe I should set
$EnableFixedUrlRedirect=0; But that seems a shame.)





More information about the pmwiki-users mailing list