[Pmwiki-users] Getting rid of pagename=... in the URL
Niall Durham
niall_durham
Tue Dec 2 07:39:25 CST 2003
Howdy,
I don't know if this problem has been solved already, but I saw the
issue on the list so here's my $0.02.
On a CGI-based server, the way I recently got rid of the ?pagename=
variable for each page was to use a combination of mod_rewrite and
add a line to the local.php file (to allow the pmwiki.php/foo/bar URL
formats).
Here's the mod_rewrite chunk (it will go in your .htaccess file in
the same directory that PmWiki resides in):
-----------------------------------------------------------------
RewriteEngine on
RewriteRule pmwiki.php(/[^?]+) /pmwiki.php?pathinfo=$1 [NE,QSA]
-----------------------------------------------------------------
Here's the code I added to local.php to read the pathinfo variable
(copied from some code Pat did a while ago on another site w/ a
customized CGI-based PHP support):
-----------------------------------------------------------------
if ($pagename == '') $pagename =
@substr($HTTP_GET_VARS['pathinfo'],1);
-----------------------------------------------------------------
I suppose with some improvements, the regex for mod_rewrite could be
modified to reformat the foo/bar pagename into ?pagename=foo.bar and
skip the local.php modification. I was happy it was working and left
it as is. :)
HTH,
Niall
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
More information about the pmwiki-users
mailing list