Results 1 to 4 of 4

Thread: Case insensitive URL Redirect

  1. #1
    Join Date
    Jul 2010
    Posts
    1

    Default Case insensitive URL Redirect

    Looking for a better way to setup a case insensitive URL redirect such that if user types
    www.mysite.com/SPEEDmachine
    it redirects them to
    www.mysite.com/speed-machine-part-1/

    I have the following brute force rules setup in .htaccess and these work fine:

    RewriteEngine On
    RedirectMatch /speedmachine http://www.mysite.com/speed-machine-part-1/
    RedirectMatch /SpeedMachine http://www.mysite.com/speed-machine-part-1/
    RedirectMatch /SPEEDMACHINE http://www.mysite.com/speed-machine-part-1/

    However, the above rules fail for a different capitalization mix, such as: mysite.com/SpEEdMachinE

    I tried the cPanel URL Redirect app, however it only handles the specific URL capitalization as I type it:
    RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.mysite.com$
    RewriteRule ^speedmachine\/?$ "http\:\/\/www\.mysite\.com\speed\-machine\-part\-1\/\/" [R=301,L]

    I tried adding NC flag to the [R=301,L] options, for example
    [R=301,L,NC]
    but this has no affect and a mixed case URL doesn't redirect.

    Appreciate your help.

  2. #2
    Join Date
    Apr 2008
    Location
    Chasing the Holy Grail - Pacific Northwest
    Posts
    1,312

    Default

    Try this method, but heed the warning. I would limit the rule to just the letters you need. Found with a google search on rewriterule lowercase.

    http://www.webmasterworld.com/forum92/5308.htm
    In the Hyperion universe, a farcaster is an instantaneous transportation device.
    Experience: The thing you get just after you need it.

  3. #3

    Default

    I'm not too good with htaccess, would this work or would it be too cumbersome:

    have a rule to extract the page value (SpEEdMachinE)
    using php convert the value to all lowercase (speedmachine)
    attach it to your web address (http://www.mysite.com/speedmachine)
    load a it as a new page.

    ???
    Matt

    My life can be summed up in one word, "indescribable".

  4. #4
    Join Date
    Feb 2006
    Location
    Florida, USA
    Posts
    1,505

    Default

    Use a php file as your 404 page that looks through the directory for similarly named files.
    If at first you don't succeed, try reading the instructions.
    semlar.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •