[pmwiki-users] Need help with Clean URLS

Joachim Durchholz jo at durchholz.org
Tue Apr 25 03:03:43 CDT 2006


Philip Stitt schrieb:
> This is what I've added to my .htaccess file (which is also in the main
> web folder):
> 
> RewriteEngine On
> RewriteBase /
> RewriteRule ^$           index.php  [L]
> RewriteRule ^index.php$  index.php  [L]

I'm pretty sure that the last line above results in an endless loop.
I think that [L] flag just terminates the current round of rewriting, 
the whole thing will be turned into a subrequest, which starts the 
rewrite process from scratch.
I'm not 100% sure with that; the Apache docs are a bit fuzzy around the 
issue. However, I did have some cases of endless rewrite loops that 
could be explained that way.
On the browser side, you'll just see a 500 Internal Server Error page. 
You'll have to look in the server's error log for a useful error message.

> RewriteRule ^([^/a-z].*) index.php?n=$1  [QSA,L]
> 
> and this is what's in my local/config:
> 
> <?php if (!defined('PmWiki')) exit();
> $EnablePathInfo = 1;
> $ScriptUrl = "http://mysite.com";
> 
> The result: when I click links from the home page, I get clean URLs in
> my browser, but to non-existant pages. If I type in the
> "index.php?n=GroupName.PageName", that still works. 

The URLs you get in your browser are probably those that PmWiki 
generates. These are solely controlled by the $EnablePathInfo 
configuration, and technically unrelated to what the rewrite engine 
does. (Of course, the rewrite engine should then correctly interpret 
these URLs.)

> By the way, I don't own the server, I'm using godaddy for hosting, if
> that helps. Can anyone see if I'm doing something wrong in my
> htaccess or config file? Thanks!

Hmm... figures. It seems that godaddy has configured their server so 
that it ignores local .htaccess files (this might be motivated by 
performance or security considerations).

You can find out using these steps:
* Create a new directory (say, test).
* Upload a test.html file that says "Hello, world!" or something.
* Browse to the test.html file and verify that it displays as it should.
* Create a .htaccess in test/,  with these lines:
     Order allow,deny
     Deny from all
* Reload the test.html file.

If the reload works just fine, the .htaccess is ignored, and you have no 
chance of getting rewrite-based CleanUrls to work (or, for that matter, 
anything else that needs .htaccess).
If the reload results in a Permission Denied page, the .htaccess is 
honored and your problems with CleanUrls have other causes.

Regards,
Jo




More information about the pmwiki-users mailing list