[pmwiki-users] I need help with clean URLs

Pico pmwiki at ben-amotz.com
Mon Aug 14 19:58:57 CDT 2006

info at theburroughsproject.com wrote:
>> You might try removing the RewriteBase line
> I tried that and it had no effect
>> Also, remove any index.php file that you may have in your
>> document root, and see if the url
>>    http://www.example.com/index.php
>> works (you should see the PmWiki home page if it does).
>> If that url doesn't work, try creating a _completely empty_
>> index.php file and see what happens.
> I didn't have an index.php file anywhere, and
> "http://www.example.com/index.php" worked fine.
> I went ahead and created a blank index.php file, just to see what
> happens, and there was no effect at all.
>> I'm also wondering if the Apache webserver at GoDaddy is doing
>> the equivalent of "AcceptPathInfo Off" and returning the 404
>> error before ever trying the .htaccess or the mod_rewrite rules.  
>> You could try adding
>>    AcceptPathInfo On
>> to your .htaccess and see if that resolves the 404.
> I added the line:
> AcceptPathInfo On
> to the top of the .htaccess file. This produced a 500 Internal Server
> error.
>> Also, do you happen to know what version of Apache is being used?
>> (You can set $EnableDiag=1; in local/config.php, then use ?action=phpinfo
>> to have PmWiki report the Apache version and configuration.)
> It appears to be Apache 1.3.33 
>> Lastly, perhaps you could send me (privately if you want) the
>> actual url of the site so I could take a look?  
> Absolutely, it's at http://www.howtofreaks.com
>> I'm using GoDaddy and got my CleanURLS working last night (after having the
>> exact same problem).  So, presumably, that should take the hosting issues off
>> the table.  (But if you need more info to compare hosting settings, I can
>> provide them).
> That's very encouraging! I'm using the deluxe hosting with php and cgi,
> with "hosting configuration 2.0" enabled. I have no subdomains
> configured, and I'm not using farms. If you could give me more info
> about it, that would be great, as I currently have no other leads to go
> on.
>>>> In my root document folder I have only two items: one folder named
>>>> "pmwiki", and one .htaccess  
>>>> file. This is an exact copy of what's in my .htaccess file:
>>>> # Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
>>>> RewriteEngine On
>>>> # The rewrite base will be the document root.
>>>> RewriteBase /
>>>> # Send requests without parameters to pmwiki.php.
>>>> RewriteRule ^$           pmwiki/pmwiki.php  [L]
>>>> # Send requests for index.php to pmwiki.php.
>>>> RewriteRule ^index\.php$ pmwiki/pmwiki.php  [L]
>>>> # Send requests to pmwiki.php, appending the query string part.
>>>> RewriteRule ^([^/a-z].*) pmwiki/pmwiki.php?n=$1  [QSA,L]
>>> This looks exactly right to me.  You might try removing the
>>> RewriteBase line and see if that helps.
>> FWIW, this may have been part of the problem in my setup.  I ended up 
>> changing the RewriteBase line from "/user1" to "/" on an Example One 
>> setup, but my setup was very different: WikiFarm, fields located at
>> www.example.com/user1 etc, subdomains (setup through GoDaddy control panel) 
>> that make "www.example.com/user1" appear at "user1.example.com", and no 
>> separate pmwiki folder beneath the field subdomains
>> "www.example.com/user1/field.php" instead of
>> "www.example.com/user1/pmwiki/field.php")
> I'm using: "RewriteBase /" as well, but I'm using an example 3 setup.
>> I note the only things that are missing from his .htaccess file, as 
>> compared with mine, are the entries for 
>>> Also, remove any index.php file that you may have in your
>>> document root, and see if the url
>>>     http://www.example.com/index.php
>>> works (you should see the PmWiki home page if it does).
>>> If that url doesn't work, try creating a _completely empty_
>>> index.php file and see what happens.
>> Again, FWIW, that was part of the process I followed in fixing mysetup. 
>> (Unfortunately, I can't say exactly which change fixed my setup, and I 
>> wasn't able to backtrack and re-break my setup to identify the exact fix).
> I'm not sure I follow you, Pico... what's missing from my .htaccess
> file? I have no index.php anywhere, but when I go to
> www.example.com/index.php, it successfully shows my Main.HomePage. I'm
> not sure what you were saying - what was it that "was part of the
> process" you followed that fixed your setup?

Oops, sorry, I didn't finish the sentence.  What I meant to say was that 
the only things that are missing are the extra lines for serving 
existing content (which shouldn't be an issue in your situation). 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

>> Hey, wait a minute, while you are at it, shouldn't you look for and delete,
>> or rename, any of the other directory indexes that might be getting 
>> called before index.php.  On GoDaddy, they supply a welcome.html file with 
>> new accounts.  On some servers, index.php can appear pretty far down on 
>> the list of directory indexes (I see one list that places index.php at 
>> 9 of 13 on Unix).  So, specifically, I would look for any files that start 
>> with index.* welcome.* and default.* and delete, move, or rename them.  
>> Are there any others I missed?
> I have deleted all of that, and everything else I could. There is a
> folder called "stats" that I cannot delete (and shouldn't make any
> difference). Other than that, there are only 2 things in my main
> directory: My .htaccess file, and my "pmwiki" folder, which contains a
> fresh install of PmWiki 2.1.12, which I have not altered or added to in
> any way except to add a config.php file (which is at
> /pmwiki/local/config.php) which has this (and only this) in it:
> <?php if (!defined('PmWiki')) exit();
> ## Use "Clean URLs".
> $EnablePathInfo = 1;
> $ScriptUrl = "http://www.howtofreaks.com";
> ## more configuration settings...
> $EnableDiag=1;
> And that's it - nothing more, nothing less. I suppose if it came down to
> it, Pico, I could create a new account that was configured just like
> yours, and try to figure it out that way... at least I know now it can
> work at godaddy, which is great.

Wait, I think I may be on to something else.  Look at your pmwiki folder 
and see if you see "pmwiki.php" or "Pmwiki.php" (the difference is an 
initial capital P).  My hunch is that you have "Pmwiki.php" (with a 
capital P) and that if you renamed the file to start with a lowercase 
"p" everything might start working.

My guess is based on a bit of trial and error with my site and yours.

On my site, I tried commenting out the two lines on my config.php (one 
at a time) and observed what appears in my address bar when I click on 
the link for WikiSandbox.

1. Both options enabled

$EnablePathInfo = 1;
$ScriptUrl = "http://www.howtofreaks.com";

Result: www.example.com/Main/WikiSandbox

2. Comment out enablepathinfo

##$EnablePathInfo = 1;
$ScriptUrl = "http://www.howtofreaks.com";

Result: www.example.com/?n=Main.WikiSandbox

3. Comment out both

##$EnablePathInfo = 1;
##$ScriptUrl = "http://www.howtofreaks.com";

Result: www.example.com/pmwiki.php?n=Main.WikiSandbox

Now, when I went to your site and tried plugging equivalent addresses, 
only #2 worked.  Specifically:


Opened your WikiSandBox page, but


Generated a 404 page

So, on a hunch, I tried capitalizing the P in Pmwiki.php, like this


and *it worked*  I got your WikiSandBox page.

To test this one step furthr, I went to my site, renamed my file to 
capitalize the first letter, and observed the same results: I got a 404 
message until I capitalized the first letter in the address bar.

Now, I'll be the first to admit that I don't really understand much of 
anything about any of this expect for what I am observing through my own 
trial and error, but I think I may have stumbled into a helpful observation.

If your pmwiki.php file is not cpaitalized, or if renaming it doesn not 
fix the problem, I would consider commenting out the lines on your 
config.sys file and see what results you get (on your address bar, as 
well as in the browser window) and see if those results compare to what 
I observed.


More information about the pmwiki-users mailing list