case insensitive redirects?

Discussion in 'HTML' started by Denise, Sep 26, 2006.

  1. Denise

    Denise Guest

    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
    Denise, Sep 26, 2006
    #1
    1. Advertising

  2. 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/
    Jukka K. Korpela, Sep 26, 2006
    #2
    1. Advertising

  3. 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
    Alan J. Flavell, Sep 26, 2006
    #3
  4. Denise

    Denise Guest

    "Alan J. Flavell" <> wrote in message
    news:p...
    > 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
    Denise, Sep 26, 2006
    #4
  5. Denise

    Denise Guest

    "Jukka K. Korpela" <> wrote in message
    news:AEfSg.20567$...
    > 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
    Denise, Sep 26, 2006
    #5
  6. 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
    Alan J. Flavell, Sep 26, 2006
    #6
  7. Denise

    Denise Guest

    "Alan J. Flavell" <> wrote in message
    news:p...
    > 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
    Denise, Sep 26, 2006
    #7
  8. Denise

    Denise Guest

    -
    "Alan J. Flavell" <> wrote in message
    news:p...
    > 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
    Denise, Sep 26, 2006
    #8
  9. 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/platform/windows.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
    Alan J. Flavell, Sep 26, 2006
    #9
  10. Denise

    Denise Guest

    -
    "Alan J. Flavell" <> wrote in message
    news:p...
    > 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/platform/windows.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
    Denise, Sep 26, 2006
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Hunt

    searching lines case-insensitive

    James Hunt, Jun 4, 2004, in forum: Perl
    Replies:
    4
    Views:
    559
    James Hunt
    Jun 5, 2004
  2. Tee
    Replies:
    3
    Views:
    7,753
    Herfried K. Wagner [MVP]
    Jun 23, 2004
  3. Replies:
    1
    Views:
    2,450
    Mark P
    Apr 6, 2007
  4. Xah Lee
    Replies:
    4
    Views:
    923
  5. Bennett Haselton
    Replies:
    2
    Views:
    185
    Peter J. Holzer
    Mar 23, 2010
Loading...

Share This Page