+ Reply to Thread
Results 1 to 3 of 3

Thread: Case insensitive redirect

  1. #1
    lydia09 is offline x10Hosting Member lydia09 is an unknown quantity at this point
    Join Date
    Dec 2009
    Posts
    64

    Case insensitive redirect

    Hi everybody,
    Sorry if this is the wrong forum to put this in, first off.

    I was wondering, I know there's a way to do redirects in the control panel, but is there a way to do a case-insensitive redirect?

    For example, I have a directory like this:

    mysite.com/Directory

    That redirects to:

    mysite.com/Directory/Index.php.

    When I type in:
    mysite.com/directory

    or any other variant with the improper capitalization, I get a 404 not found error. I'd like to be able to redirect as long as the directory is right without capitalization, so if a user accidentally forgets to capitalize, it isn't a problem.

    Can anyone tell me, please, is there a way to do this?

    Thanks,
    Lydia
    Edit:
    Never mind, I got it.

    For future reference, it doesn't look like you can do this in the control panel, you have to do it in htaccess. Add "NC" after the "R" in your redirect directive to make "[R,NC]" and that does it.

    Hope that helps someone,
    Lydia
    Last edited by lydia09; 01-30-2010 at 09:25 PM. Reason: Automerged Doublepost

  2. #2
    abelonger is offline x10Hosting Member abelonger is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    8

    Re: Case insensitive redirect

    It's amazing the things you can do with htaccess. Glad you figured it out!

  3. #3
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    Re: Case insensitive redirect

    For even further future reference, it's mod_rewrite they're talking about =P
    Further more, NC doesn't decapitalise the string at all, it just makes the pattern case-insensitive. Perhaps it happens to work for you, but there's no reason why it should.

    Adding this to your htaccess *should* work, although it doesn't appear to be on my own development environment :s
    Code:
    RewriteCond %{REQUEST_URI} [A-Z]
    RewriteRule ^(.*)$ ${tolower:$1}
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

+ Reply to Thread

Similar Threads

  1. Redirect
    By liguehs in forum Free Hosting
    Replies: 3
    Last Post: 07-23-2009, 09:12 AM
  2. Advice for buying new pc case
    By yooby in forum Computers & Technology
    Replies: 6
    Last Post: 05-20-2008, 12:08 PM
  3. Redirect
    By BlueIce in forum Free Hosting
    Replies: 3
    Last Post: 10-21-2007, 08:06 AM
  4. New Computer Case
    By Zenax in forum Off Topic
    Replies: 8
    Last Post: 06-04-2007, 02:37 PM
  5. Cpanel Redirect problem
    By BigEmmaFanz in forum Free Hosting
    Replies: 5
    Last Post: 12-10-2005, 04:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers