mod_rewrite force to lower case

Posted on 2009-02-23
Last Modified: 2012-05-06
I dont believe this is possible, just asking for confirmation.  But if I want to make sure that all extensions, page names or folder names are all lower case that without listing each one out individually I cannot do it through Mod_Rewrite.  Is that true?
Question by:iceman19330
    LVL 29

    Expert Comment


    do you meant url case change ??? like all lower case

    have a look this 2 , if you meant something like this

    LVL 27

    Accepted Solution

    If you can use the rules in your httpd.conf instead of .htaccess files, you could use an internal mapfunction (tolower).

    If you don't have such access, you may want to ckeck for uppercase, rewrite to foo.php internally, using php functions (strtolower) to convert $_SERVER['REQUEST_URI'] to lowercase and issue a 301 redirect via the header() functions.
    # httpd.conf
    RewriteEngine on
    RewriteMap lower int:tolower
    RewriteRule [A-Z] ${lower:%{REQUEST_URI}} [R=301,L]
    # alternate approach vis .htaccess
    RewriteEngine on
    RewriteRule [A-Z] /redirect.php?uri=%{REQUEST_URI} [L]

    Open in new window


    Author Comment

    Like /Product-blah.html to /product-blah.html but dynamically, because i dont want to have to write a rule for each case.  The other one was if it was product.HTML or Product.HTML to product.html, also doing that dynamically.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now