[pmwiki-users] Alternate Solution to Case-Sensitive URL Problem
Patrick R. Michaud
pmichaud at pobox.com
Fri Jan 28 17:29:14 CST 2005
On Fri, Jan 28, 2005 at 02:51:39PM -0800, Menachem Shapiro wrote:
> What about a solution like this:
> The first time you create a URL, it uses whatever case you use.
> From then on, any URL with the same letters, no matter what the case,
> redirects to the first URL created.
Summary of several of my earlier posts: Often the case used to
initially create the page isn't the case you want used in titles or
But let's back up a few steps and take a fresh look at the problem.
The original question was as follows:
> I am running a wiki on a Linux server. The URLs are case sensitive so:
> http://otterprojectonline.info/pmwiki/Main -> redirect
> http://otterprojectonline.info/pmwiki/main -> 404 error
> http://otterprojectonline.info/pmwiki/MAIN -> page not found error
> all get different results.
> Is there any way to turn this off and make it that all of the above
> URLs go to pmwiki/Main ?
First, let's note that there are very few actual web sites that
support this. On nearly all of the web sites that I frequent, changing
the case of a URL results in a "page not found" error of some sort.
So PmWiki is not operating at all "abnormally" in this respect.
Next, the second url above -- the one that results in the 404 error --
is probably due to a RewriteRule only being applied to urls that begin
with an uppercase letter at that point. Since "main" doesn't begin
with an uppercase letter, the RewriteRule isn't being applied, and you'll
get the 404 error because pmwiki never gets called.
The remaining two urls are "normal". The third url would happen to
work on any OS that uses case-insensitive filenames, so we don't need
to do anything for them. If we want PmWiki to support case-insensitive
urls (which again is itself somewhat rare on the web), then we only
need that support for a case-sensitive OS such as Linux.
So, here's what I propose. If someone is on a case-sensitive OS
and wants case-insensitive urls, then support for this is going
to be provided through an optional Cookbook script. This doesn't
burden sites where these issues aren't present.
The cookbook script will check to see if the requested page name
(case-sensitive) exists; if not then it will do a case-insensitive
scan of the page stores to find a matching page, and if one is found
the script will set the $pagename to correspond with the name of the
found page. Processing continues as normal. If no matching
page is found then the $pagename is left alone, as now, and whatever
case is there becomes the case of the new page.
More information about the pmwiki-users