Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9094725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:25:11+00:00 2026-06-16T23:25:11+00:00

I’m running Ubuntu 12.04 with Apache 2.2.22 and PHP 5.3.10. I’d like users to

  • 0

I’m running Ubuntu 12.04 with Apache 2.2.22 and PHP 5.3.10. I’d like users to be able to request pages on my site without having to type the ‘.php’ extension, and without having to worry about case sensitivity. For example, URLs like these…

http://www.site.com/test/phpinfo
http://www.site.com/test/PhPiNfO

…should both lead to:

http://www.site.com/test/phpinfo.php

I started with case insensitivity by following the accepted answer in this question. Here’s what my ‘/etc/apache2/sites-available/default’ file looks like…

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www

        RewriteMap lc int:tolower

        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        <Directory /var/www/test>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

…and here’s my .htaccess file:

RewriteEngine On
RewriteRule ^([a-z]+)/([a-z\-]+)$ /${lc:$1}/${lc:$2}.php [L,NC]

The file extension part is working, but for some reason case sensitivity is still being enforced. My Apache error log is filled with lines like this:

[Sat Jan 05 23:10:41 2013] [error] [client 192.168.1.9] File does not exist: /var/www/test/phpinfO

Any ideas what I’m doing wrong here?

EDIT: After experimenting for a couple hours, I’m seeing the most bizarre behavior! I thought maybe my .htaccess file was simply being ignored, so I filled it with gibberish. This produced an internal server error as expected. I then tried just these two lines in my .htaccess file…

RewriteEngine On
RewriteRule ^/(.*)$ /${lc:$1}

…and tried to access test/phpinfO.php unsuccessfully. I then deleted the .htaccess file and put those two lines directly into my ‘/etc/apache2/sites-available/default’ file and restarted Apache. For some inexplicable reason, the behavior I wanted is now working! I can’t possibly fathom how, since my only rule doesn’t append ‘.php’ to the URL!

This may sound odd, but it almost feels like my changes are taking effect in some delayed way. I tried some other tests that didn’t work right away, but that seemed to work later when they shouldn’t have. I keep testing and expecting my current setup to break without changing anything. Whatever the case, I am absolutely baffled.

Hope somebody can shed some f’ing light on this before I rip my brain out and smash it with a sledge hammer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T23:25:13+00:00Added an answer on June 16, 2026 at 11:25 pm

    I finally figured this one out. Well, at least part of it. It turns out that the ‘MultiViews’ option was responsible for resolving files without the ‘.php’ extension. That, in combination with these two lines in my ‘/etc/apache2/sites-available/default’ file, gives me the behavior I desire:

    RewriteEngine On
    RewriteRule ^/(.*)$ /${lc:$1}
    

    Unfortunately, I haven’t been able to determine why my .htaccess file is ignored when it has the above rules, but not ignored when it has gibberish.

    EDIT: OK, I figured out why the .htaccess file wasn’t working. It was being read, but the second rule wasn’t being matched. Here’s why, according to the Apache documentation:

    The removed prefix always ends with a slash, meaning the matching
    occurs against a string which never has a leading slash. Therefore, a
    Pattern with ^/ never matches in per-directory context.

    As a result, I changed my .htaccess file to have this…

    RewriteEngine On
    RewriteRule ^(.*)$ ${lc:$1}
    

    …and it’s finally working!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I would like to count the length of a string with PHP. The string
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.