Forum Moderators: mack

Message Too Old, No Replies

.htaccess help

fixing uppercase/lowercase file access

         

Newsmaker

4:53 pm on May 29, 2003 (gmt 0)

10+ Year Member



my site uses a mix of uppercase and lowercase file names. How do I configure my .htaccess file to ignore case?
Thx

jdMorgan

5:02 pm on May 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Newsmaker,

Welcome to WebmasterWorld [webmasterworld.com]!

Some of the directives used in .htaccess can be set to be case insensitive - mod_rewrite uses the [NC] flag, for example.

However, I'm not aware of any case-conversion capability.

The two alternatives that come to mind are:

  • Rename your files to all-lowercase
  • Create a case-conversion script, and call it from .htaccess. The script could do the case-conversion, and then <include> the originally-requested content.

    HTH,
    Jim

  • Newsmaker

    5:29 pm on May 29, 2003 (gmt 0)

    10+ Year Member



    Would love to rename all pages..but too many of the pages are indexed by Google and are driving traffic to my site (which is how i earn a living). My problem is I had the same page spidered by google, msn, hotbot before and after i made case revisions. For example:
    orginal page = www.mysite.com/XXX.htm
    current page = www.mysite.com/xxx.htm
    My hosting server company is unix based and therefore is case sensitive.

    It would be disaster for me to change all to lowercase - takes 90 days to clear out search engine indexes.

    So => is there any way .htaccess can allow a user to find my pages whether they type in upper or lower case urls?

    Thanks
    B

    jdMorgan

    6:03 pm on May 29, 2003 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    Newsmaker,

    If you have a limited number of uppercase pages, then you can use mod_alias [httpd.apache.org] or mod_rewrite [httpd.apache.org] to redirect from the uppercase to the lowercase version using a 301-Moved Permanently redirect. Rename the files to all-lowercase and fix the site-internal links. Over time, the engines will drop the uppercase versions, and you can remove the redirects.

    If you have a huge number of pages, then my original post applies:
    > Create a case-conversion script, and call it from .htaccess. The script could do the case-conversion, and then <include> the originally-requested content.

    Jim