Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > case insensitive redirects?

Reply
Thread Tools

case insensitive redirects?

 
 
Denise
Guest
Posts: n/a
 
      09-26-2006
Hi,

I have a website where a number of the pages are named after people
(authors, actually).
For example, http://example.com/name.html

However, sometimes folks looking for those pages, type in the capitalized
name:
http://example.com/Name.html , which results in a 404.

I also have a directory called something like http://example.com/ABCD/
and often folks type in http://example.com/abcd instead, which also results
in a 404.

Is there any rule I can add to my .htaccess file (short of redirecting each
page individually) to make these pages / directories case insensitive?

Thanks so much!
Denise


 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      09-26-2006
Denise wrote:

> Is there any rule I can add to my .htaccess file (short of
> redirecting each page individually) to make these pages / directories
> case insensitive?


I've got the impression that you might be able to do that in the global
configuration of the server, httpd.config file (not .htaccess), using
RewriteMap. I must admit that the Apache documentation on this is somewhat
obscure to me.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
 
 
 
Alan J. Flavell
Guest
Posts: n/a
 
      09-26-2006
On Tue, 26 Sep 2006, Denise wrote:

> I also have a directory called something like http://example.com/ABCD/
> and often folks type in http://example.com/abcd instead, which also results
> in a 404.
>
> Is there any rule I can add to my .htaccess file (short of redirecting each
> page individually) to make these pages / directories case insensitive?


Assuming Apache-based server -

The easy way is to activate mod_speling

 
Reply With Quote
 
Denise
Guest
Posts: n/a
 
      09-26-2006
"Alan J. Flavell" <(E-Mail Removed)> wrote in message
news(E-Mail Removed). gla.ac.uk...
> On Tue, 26 Sep 2006, Denise wrote:
>
>> I also have a directory called something like http://example.com/ABCD/
>> and often folks type in http://example.com/abcd instead, which also
>> results
>> in a 404.
>>
>> Is there any rule I can add to my .htaccess file (short of redirecting
>> each
>> page individually) to make these pages / directories case insensitive?

>
> Assuming Apache-based server -
>
> The easy way is to activate mod_speling
>


Thanks Alan, for the great suggestion!

Yes, it is indeed an Apache server, using version 1.3.37.

I Googled "mod_speling" and found a page about it that says the directive to
use is:
CheckSpelling on

However, I inserted that in my .htaccess and got a 500 Interal Server error.
Apparently it isn't able to work on my site, but I don't know why. I'll try
to investigate further.

all best,
Denise


 
Reply With Quote
 
Denise
Guest
Posts: n/a
 
      09-26-2006
"Jukka K. Korpela" <(E-Mail Removed)> wrote in message
news:AEfSg.20567$(E-Mail Removed). ..
> Denise wrote:
>
>> Is there any rule I can add to my .htaccess file (short of
>> redirecting each page individually) to make these pages / directories
>> case insensitive?

>
> I've got the impression that you might be able to do that in the global
> configuration of the server, httpd.config file (not .htaccess), using
> RewriteMap. I must admit that the Apache documentation on this is somewhat
> obscure to me.
>
> --
> Jukka K. Korpela ("Yucca")
> http://www.cs.tut.fi/~jkorpela/

Hi Jukka,

Thanks for your suggestion. I'll look into it, but I think I don't have
access to the httpd.config file.

best,
Denise


 
Reply With Quote
 
Alan J. Flavell
Guest
Posts: n/a
 
      09-26-2006
On Tue, 26 Sep 2006, Denise wrote:

> I Googled "mod_speling"


Go directly to the Apache documentation - it won't bite

In this case - http://httpd.apache.org/docs/1.3/mod/mod_speling.html

> and found a page about it that says the directive to
> use is:
> CheckSpelling on


true

> However, I inserted that in my .htaccess and got a 500 Interal
> Server error.


oops. Well, the server's error log should show why it complained. If
you don't get access to the error log then debugging is much harder -
do you get any support from the service provider for this kind of
issue?

good luck, anyway
 
Reply With Quote
 
Denise
Guest
Posts: n/a
 
      09-26-2006
"Alan J. Flavell" <(E-Mail Removed)> wrote in message
news(E-Mail Removed). gla.ac.uk...
> On Tue, 26 Sep 2006, Denise wrote:
>
>> I Googled "mod_speling"

>
> Go directly to the Apache documentation - it won't bite
>
> In this case - http://httpd.apache.org/docs/1.3/mod/mod_speling.html
>
>> and found a page about it that says the directive to
>> use is:
>> CheckSpelling on

>
> true
>
>> However, I inserted that in my .htaccess and got a 500 Interal
>> Server error.

>
> oops. Well, the server's error log should show why it complained. If
> you don't get access to the error log then debugging is much harder -
> do you get any support from the service provider for this kind of
> issue?
>
> good luck, anyway


Hi Alan,

The error log says,
"Invalid command 'CheckSpelling', perhaps mis-spelled or defined by a module
not included in the server configuration"

I'm sure my host could shine some light on that.

Don't know what I will do next. I've just been reading online some opinions
that the CheckSpelling directive is rather a security risk. All I really
want to do is have it check the case, which wouldn't involve any security
problems, but it seems that's not possible. So I'm going to have to think
things over.

best,
Denise


 
Reply With Quote
 
Denise
Guest
Posts: n/a
 
      09-26-2006
-
"Alan J. Flavell" <(E-Mail Removed)> wrote in message
news(E-Mail Removed). gla.ac.uk...
> On Tue, 26 Sep 2006, Denise wrote:
>
>> I Googled "mod_speling"

>
> Go directly to the Apache documentation - it won't bite
>
> In this case - http://httpd.apache.org/docs/1.3/mod/mod_speling.html
>


Indeed, that's the page I found. I didn't know the address of that page
off the top of my head (I hope you didn't either!), had to Google to find
it.

Denise


 
Reply With Quote
 
Alan J. Flavell
Guest
Posts: n/a
 
      09-26-2006
On Tue, 26 Sep 2006, Denise wrote:

> Don't know what I will do next. I've just been reading online some
> opinions that the CheckSpelling directive is rather a security risk.


That's a bit of a vague remark, but maybe it's referring to the effect
described here in the Apache documentation:

* the document trees should not contain sensitive files which could
be matched inadvertently by a spelling "correction".

Provided that you only upload to the server, files that you want to
make public, then this isn't really a problem. If you try to "hide"
some files by keeping their names a secret, then mod_speling might
expose them, I guess that's obvious, no?

> All I really want to do is have it check the case, which wouldn't
> involve any security problems, but it seems that's not possible.


Here's another possibility. If you take a look at
http://httpd.apache.org/docs/2.0/pla...dows.html#cust , then
there is, amongst other things, a recipe (third bullet point) which
will force all URLs to lower case. It uses mod_rewrite - but if your
provider has excluded mod_speling then it's on the cards that they
would have excluded mod_rewrite also. But it might be worth a try.

(don't be confused that the recipe is given for the Win32 context - it
looks equally usable in unix-ish contexts too). (Not actually tested
in practice, I admit).

Another alternative is to provide a custom 404 script which fixes-up
the kind of error you're talking about. But that would be a whole new
discussion theme...

good luck
 
Reply With Quote
 
Denise
Guest
Posts: n/a
 
      09-26-2006
-
"Alan J. Flavell" <(E-Mail Removed)> wrote in message
news(E-Mail Removed). gla.ac.uk...
> On Tue, 26 Sep 2006, Denise wrote:
>
>> All I really want to do is have it check the case, which wouldn't
>> involve any security problems, but it seems that's not possible.

>
> Here's another possibility. If you take a look at
> http://httpd.apache.org/docs/2.0/pla...dows.html#cust , then
> there is, amongst other things, a recipe (third bullet point) which
> will force all URLs to lower case.
> (don't be confused that the recipe is given for the Win32 context - it
> looks equally usable in unix-ish contexts too). (Not actually tested
> in practice, I admit).


I'll take a look at it, thanks for the idea.
>


> It uses mod_rewrite - but if your
> provider has excluded mod_speling then it's on the cards that they
> would have excluded mod_rewrite also. But it might be worth a try.


Mod_rewrite works fine.

> Another alternative is to provide a custom 404 script which fixes-up
> the kind of error you're talking about. But that would be a whole new
> discussion theme...


Yeah, I don't want to go that route.
>
> good luck



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
check file exists with case sensitive on a case insensitive filesystem Xah Lee Perl Misc 4 04-05-2009 11:21 PM
string.indexof case insensitive Guoqi Zheng ASP .Net 4 01-25-2009 02:07 AM
case insensitive find on case sensitive stl map benhoefer@gmail.com C++ 1 04-06-2007 08:42 PM
how to case select with case-insensitive string ? Tee ASP .Net 3 06-23-2004 07:40 PM
searching lines case-insensitive James Hunt Perl 4 06-05-2004 06:13 PM



Advertisments