Redirecting Upper case and Lower case URLs

Discussion in 'HTML & Website Design' started by Minterest, Oct 25, 2007.

  1. #1
    hello,

    I want to redirect all the requests in lower case or upper case to same location. How can I do like that?

    E.g lets say my domain is website.com and I have a page located at website.com/MakeMoneyOnline.htm

    Then how can I setup a redirect so that all requests to website.com/makemoneyonline.htm goes to website.com/MakeMoneyOnline.htm... not just for one link but for all link...

    It means the Web Host must be case independent.... Is this really possible????????//
     
    Minterest, Oct 25, 2007 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    make all your files in lowercase, then modify your server's 404 handler script to convert the URL to lower case, check if the desired file actually exists as all lowercase - true, redirect to that. If it's not available, send the 404 as normal.

    a php 404 handler would be easiest, just check $REQUEST_URI
     
    deathshadow, Oct 25, 2007 IP
  3. Minterest

    Minterest Well-Known Member

    Messages:
    2,694
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    180
    #3

    Hey am using HTML... and i dont want to convert the files to lower cases.. I need mixed file names like this "Credit-Cards" and not like "credit-cards"...

    so am looking for a way to redirect the request to credit-cards.htm and Credit-cards.htm to the same location...

    It means the browser should ignore the uppercase or lowercase.. and must treat the files Credit.htm or cREDIT.htm or something like this as the same and must redirect that to the original file......


    If you guys still didnt get me then try this

    go to ur windows exlorer and try this

    Enter C:\Program Files in the address bar it goes to program files...

    now enter C:\ProgRAm FilEs and C:\program files and C:\Program FILES.... all works correctly... I want my website to be like this...... ANY SOLUTION?
     
    Minterest, Oct 25, 2007 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #4
    unlikely if you are on a *nix server, because the filesystem on the server itself is case sensitive.... as such 'Credit-Cards.html', 'credit-cards.html' and 'CREDIT-CARDS.HTML' would all be separate and distinct files on the server.

    Which is why 99.99% of your web designers out there put everything in lower case in the first place.

    Your solutions would be:

    make a copy of the file for every possible combination of upper and lower case you want to trap.

    Make one copy the way you want, and make separate redirect files for each spelling.

    Use a consistant naming like all lower case or all upper case and use a 404 handler to trap 'incorrect' use of case

    or you could create a php cross-reference array to compare the url to output the correct one. The overhead for this would be a total waste. (which is why *nix filesystems are case sensitive, to reduce the overhead and make it more efficient)

    In any case, it ALL has to go server side.

    Remember, the internet is *nix based which has very strict rules, not the sloppy windows 'we don't give a ****' method.
     
    deathshadow, Oct 25, 2007 IP
  5. Minterest

    Minterest Well-Known Member

    Messages:
    2,694
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    180
    #5
    Thanks for that. I appreciate it.


     
    Minterest, Oct 26, 2007 IP