[pmwiki-users] Re: Clean URLs

CB chrisbar at wanadoo.fr
Sun Apr 17 05:01:14 CDT 2005


>>I solved (I hope) my problem with the two following rules, in this
>>order :
>>    
>>
> >
> >   RewriteRule C\:/apache/phpweb/pmwiki pmwiki.php [L]
>  
>
>>  RewriteRule ^([^/a-z].*) pmwiki.php?n=$1 [QSA,L]
>>    
>>
> >
>  
>
>>I don't really understand why I need the first rule in this forme,
>>but after reading Apache's log(*), It' the only way I get it to work.
>>
>>(*) : I saw strange things in the logs, like "GET 
>>/pmwiki/?n=C:/apache/phpweb/pmwiki HTTP/1.1" when pointing my browser
>>to "http://localhost/pmwiki" ...
>>    
>>
>
>A request like "GET /pmwiki/?n=C:/apache/phpweb/pmwiki" Should Not
>Happen. I think it's the consequence of some earlier problem.
>
>Did you try to turn rewrite logging on? It has helped me tremendously
>when diagnosing similar problems.
>
>The current CleanUrls recipe is unnecessarily complex in one respect. 
>The rewrite rule for ^/?$ tries to intercept the "directory index" case, 
>which we could equally well let Apache do, by doing something like
>
>   DirectoryIndex pmwiki.php?n=Main.HomePage
>
>I had planned to update the recipe, but I never found the time to 
>properly review the Apache docs (to make sure I don't make some silly 
>error) and do the testing (to detect whether I made some silly error 
>anyway).
>
>DirectoryIndex should handle that case best though. It's intended for 
>exactly that situation, it doesn't have funny borderline cases like ^/?$ 
>does, and ^/?$ did some strange things that I didn't fully understand so 
>I'd love to get rid of it.
>
>  
>
Well, I restarted with a simple beta31 installation, and no skin.
Details are below.
Experiments show that I need at leat the DirectoryIndex  directive, and 
the 2 rewrite rules.
A internal redirection appends due may be to some header() function in 
pmwiki php code arising when the wiki root url is called. I don't know 
why (windows XP particularity ??).

Then, I switched back to my normal config, and all things continue to 
work...

Christophe.

config.php :
   <?php
   $ScriptUrl = 'http://localhost/pmwiki';
   $EnablePathInfo = 1;
   ?>
.htaccess :
   DirectoryIndex pmwiki.php
   AcceptPathInfo On
   Options +FollowSymLinks
   RewriteEngine on
   RewriteRule /pmwiki pmwiki.php [L]
   RewriteRule ^([^/a-z].*) pmwiki.php?n=$1 [QSA,L]

access.log :
127.0.0.1 - - [17/Apr/2005:11:27:49 +0200] "GET /pmwiki HTTP/1.1" 301 232
127.0.0.1 - - [17/Apr/2005:11:27:49 +0200] "GET /pmwiki/ HTTP/1.1" 200 6411
127.0.0.1 - - [17/Apr/2005:11:27:49 +0200] "GET /favicon.ico HTTP/1.1" 
404 209

rewrite.log : level 9
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159a7f8/initial] (3) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] applying pattern '/pmwiki' to uri 
'C:/apacheweb/web/phpweb/pmwiki'
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159a7f8/initial] (2) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] rewrite C:/apacheweb/web/phpweb/pmwiki 
-> pmwiki.php
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159a7f8/initial] (3) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] add per-dir prefix: pmwiki.php -> 
C:/apacheweb/web/phpweb/pmwiki/pmwiki.php
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159a7f8/initial] (2) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] strip document_root prefix: 
C:/apacheweb/web/phpweb/pmwiki/pmwiki.php -> /pmwiki/pmwiki.php
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159a7f8/initial] (1) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] internal redirect with 
/pmwiki/pmwiki.php [INTERNAL REDIRECT]
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159c800/initial] (3) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] strip per-dir prefix: 
C:/apacheweb/web/phpweb/pmwiki/ ->
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159c800/initial] (3) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] applying pattern '/pmwiki' to uri ''
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159c800/initial] (3) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] strip per-dir prefix: 
C:/apacheweb/web/phpweb/pmwiki/ ->
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159c800/initial] (3) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] applying pattern '^([^/a-z].*)' to uri ''
127.0.0.1 - - [17/avr./2005:11:27:49 +0200] 
[localhost/sid#26bed8][rid#159c800/initial] (1) [per-dir 
C:/apacheweb/web/phpweb/pmwiki/] pass through 
C:/apacheweb/web/phpweb/pmwiki/

Hard to read isn't it ? ;-)





More information about the pmwiki-users mailing list