[pmwiki-users] mod_rewrite problem (fixed)

James DeVain jamesdevain at mail.com
Thu Jul 10 16:16:34 CDT 2008

(sorry, there were a couple of mistakes in the original, here it is fixed)

Hi. Sorry that this is such a long post, but I wanted to get everything out
there the first time. Basically, I'm trying to use mod_rewrite to shorten
my URLs, but in a way that doesn't seem to be covered on "Clean URLs" page.

I have a wiki farm. Currently, it's set up like this:

my index.php file looks like this:

<?php include('zuhsfarm/pmwiki.php');

and is in the root folder, as is the farm directory. Each field is in its
own directory, which is in the root folder. So the basic structure is:


This is what I have in "/.htaccess":

# Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
RewriteEngine On
# Send http:// request to http://www.
RewriteCond %{http_HOST} ^zuhs\.com
RewriteRule ^(.*) http://www.zuhs.com/$1 [L,R=301]
# Define the rewrite base.
RewriteBase /
# Send requests without parameters to pmwiki.php.
RewriteRule ^$           index.php  [L]
# Send requests for index.php to pmwiki.php.
RewriteRule ^index\.php$ index.php  [L]
# Send requests to pmwiki.php, appending the query string part.
RewriteRule ^([^/a-z].*) index.php?n=$1  [QSA,L]

and this is what I have in "/thisfield/.htaccess":

RewriteEngine On
RewriteBase /thisfield/
RewriteCond %{http_HOST} ^zuhs\.com 
RewriteRule ^(.*) http://www.zuhs.com/thisfield/$1 [L,R=301]
RewriteRule ^$           index.php  [L]
RewriteRule ^index\.php$ index.php  [L]
RewriteRule ^([^/a-z].*) index.php?n=$1  [QSA,L]

Also, this is what I have in "/thisfield/index.php"

<?php include('../zuhsfarm/pmwiki.php');

Thus, "thisfield" is reachable at "www.zuhs.com/thisfield"

It all works fine, but here's my problem: I would *rather* have all of
the fields in a single folder named "fields", like:


- but have them still be reachable at URLs like "zuhs.com/thisfield"
(rather than "zuhs.com/fields/thisfield".

I've been banging my head against this mod_rewrite wall all day, but I just
can't get anything to work. Anyone know how I can do this? Any help would
be greatly appreciated.


Be Yourself @ mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com

More information about the pmwiki-users mailing list