.JPG" height="50" alt="Next"> There are the following ph" /> .JPG" height="50" alt="Next"> There are the following ph" /> .JPG" height="50" alt="Next"> There are the following ph"/>

Case sensitivity only by all lowercase or all uppercase?

296 views Asked by At

In my CMS I've made a style adaptation in PHP code.

<img src="/var/thumbs<?= $next_page_url ?>.JPG" height="50" alt="Next">

There are the following phenomenon:

If a file name has both uppercase and lowercase letters (PIC123a.jpg), it does not work. If a file name only uppercase (PIC123.JPG) or only lowercase (pic-test.jpg) it worked.

If I use the entries in the .htaccess it also works with mixed uppercase and lowercase letters.

<IfModule mod_speling.c>
  CheckCaseOnly On
  CheckSpelling On
</IfModule>

But I want to know why it will not work without these .htaccess entries, respectively with only uppercase or only lowercase.

PS: The CMS have only the var $next_page_url, not $next_page_item. I don't want to make too many PHP hacks.

--- EDIT --- More Infos ---

Without the htaccess entry:

If the file extension uppercase AND the file name uppercase (PIC123.JPG) = it works

If the file extension lowercase AND the file name lowercase (pic-test.jpg) = it works

If the file extension lowercase AND the file name has uppercase (PIC123.jpg) = don't work

1

There are 1 answers

2
Aniruddha Chakraborty On

Whenever you're hitting a url it means you're hitting a server like apache or nginx . php itself is not a server . it just process requests btu those requests are firstly handled by web servers like apache or nginx

The CheckSpelling operative makes Apache perform a more involved effort to find a match e.g. correcting common spelling mistakes

So that is why this chunk of code is used to do the task

<IfModule mod_speling.c>
  CheckCaseOnly On
  CheckSpelling On
</IfModule>

Get it? :)

Happy codding!