[pmwiki-users] Rewrite Rule Question

Patrick R. Michaud pmichaud at pobox.com
Mon Aug 14 10:34:08 CDT 2006


On Mon, Aug 14, 2006 at 04:21:27PM +0200, Tom wrote:
> i do not really know how the rules work, but maybe someone can help me here.
> 
> I successfully got my urls down to: www.domain.com/Group/Name
> 
> Now i tried to eliminate one directory from being processed (cgi-bin):
> 
> RewriteEngine On
> RewriteBase /
> RewriteRule ^cgi-bin/(.*) /cgi-bin/$1 [L]
> RewriteRule ^$           /pmwiki/pmwiki.php  [L]
> RewriteRule ^([a-z].*) /pmwiki/pmwiki.php?n=$1  [NC,QSA,L]

> 
> Comment:
> - I know that the last rule is not original (i allow small letters for
> links)

Ouch.  You may need to eliminate more than just the cgi-bin/
directory from processing -- otherwise, how will browsers ever
access skin files and other items in pub/ ?

> Does someone know where i am wrong, and how i can exclude one (or more)
> directories from being processed here?

The simpler approach may be to use RewriteCond to specify
the urls that you don't want rewritten, thus:

    RewriteEngine On
    RewriteBase /
    RewriteCond ${REQUEST_URI}  !^cgi-bin
    RewriteRule ^$           /pmwiki/pmwiki.php  [L]
    RewriteRule ^([a-z].*) /pmwiki/pmwiki.php?n=$1  [NC,QSA,L]

The RewriteCond line says to exclude any urls that begin with 
cgi-bin from being rewritten.  

But there still may be difficulties with accessing the files
in PmWiki's pub/ directory.

Hope this helps,

Pm




More information about the pmwiki-users mailing list