Case sensitive

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


What is the best way to make a web sub-directory page case insensitive?
For example, if I have the following:, how can I
ensure that anyone typing will still reach the same
page.  I'm not sure of the hosting package, I presume it is Apache but I
don't have access to a htaccess file or php.

Any suggestions would be much appreciated.


Re: Case sensitive

Geoff wrote:
Quoted text here. Click to load it
Typing it is not a problem - links are.  So long as no one links using
the wrong case, there should not be a problem.

TK ~ aka Terry Kimpling learn/make juggle/balance equipment
I'm only 63, but I already read at the 70 year old level.

Re: Case sensitive

Quoted text here. Click to load it

In that case I strongly suggest to change hosting first.

Also, instead of making a part of the URL case-insensitive I would
strongly suggest to redirect all "misspellings" to the lower case
version (301).

There is also a mod_speling [sic]:

John Bokma                                                               j3b

Hacking & Hiking in Mexico - - Perl & Python Development

Re: Case sensitive

Quoted text here. Click to load it

Which does the redirecting for you... If your new hosting provider has
Apache loading this module you can use .htaccess to do the
case-insensitive thing.

John Bokma                                                               j3b

Hacking & Hiking in Mexico -
Now also on Facebook:

Re: Case sensitive

Quoted text here. Click to load it

I know this probably isn't an option, but the simplest is to host on Windows
as that's case insensitive.

Otherwise a redirect in the .htaccess file (which I know you said you don't
have access to) or write the equivalent in php for a custom 404 handler.
 Brian Cryer

Re: Case sensitive


Quoted text here. Click to load it

Not sure that's true, at least all the time.

For a while I had a FP Windows site that was case sensitive. I didn't do
anything (or know how) to it it. Just found out the hard way.

If it's a simple directory, just creat a \Sports and a \sports and load them
with the same files.

Re: Case sensitive

AIUI, .htaccess files only work with Apache, not IIS or other Windows
servers, but the fact that you have don't have access to an existing
one doesn't prevent you creating your own to put in your webspace
root.  Assuming you code it correctly, the worst that can happen is
that it will be ignored (but if it isn't ignored and you code it
incorrectly, beware!)

I suspect that it would be quite unusual for .htaccess to be
completely disabled on a Linux server.  My own Web Hosting Package is
annoyingly restrictive, but I can and do use an .htaccess file, mainly
for mod_rewrite and redirect 301.

As the consequences of incorrectly coding an .htaccess file are
potentially catastrophic, you may care to experiment in an unimportant
sub-directory first.  I've learnt that what I'm told by the technical
support people on my hosting package isn't always true, for example,
they tell me that compression is enabled, but I've discovered that
neither mod_deflate.c nor mod_gzip.c are loaded.  Here's how I found
this out ...

I created an unimportant sub-directory off the root, and edited
robots.txt to keep the search engine crawlers out of it.

I then created four files in the sub-directory:

Test.html, contains:
This is the unnumbered test page

Test_0.html, contains:
This is test page #0

and similarly for Test_1.html and Test_2.html

and the following .htaccess for in the sub-directory:

RewriteEngine    on
RewriteBase        /directory name/

<IfModule mod_rewrite.c>
    RewriteRule    ^(.*[^_012]+)\.html$    $1_1.html    [R,L]
<IfModule !mod_rewrite.c>
    RewriteRule    ^(.*[^_012]+)\.html$    $1_2.html    [R,L]

RewriteRule    ^(.*[^_012]+)\.html$    $1_0.html    [R,L]

As both IfModule and mod_rewrite.c are functoinning, when I try to
load Test.html, the file that actually loads is Test_1.html.  If use
of IfModule had been disabled, but mod_rewrite.c loaded, then it would
have been Test_0.html, if neither, then it would have been Test.html
as originally  requested.

That's just an initial test, to prove IfModule and mod_rewrite.c.

So now that, hopefully, you know the basic test mechanism is working,
you can change mod_rewrite.c, to mod_gzip.c, or any other module for
which you want to test.  If on requesting Test.html, Test_1.html is
loaded, then the module being tested is loaded, if Test_2.html, then
it is not.

Quoted text here. Click to load it
Please always reply to ng as the email in this post's
header does not exist.  Or use a contact address at:

Re: Case sensitive

Quoted text here. Click to load it

Very many thanks to everyone for the suggestions.

I had thought of doing as you suggested in your last para and I think that
should be sufficient for what I want, but just a little worried that Google
might see it as duplication and affect my ratings.    I had thought of just
making a blank page with the "wrong-case" and doing a re-direct to the
"correct-case" using the meta tag http-equiv="refresh" content=   etc etc to
re-direct a visitor to the correct page.

Anyway I'll give them each a try.

Thanks again,


Site Timeline