In my .htaccess file, I have this code:
RewriteMap tolowercase int:tolower
RewriteRule ^(.*)$ ${tolowercase:$1} [R=301,L]
From: htaccess Uppercase URL to lowercase
This change the url from uppercase to lowercase and works fine for me.
All I want now is that I can keep my filenames in uppercase, but my server opens the files (with capitals in the names) and shows a url without capitals.
I searched for a solution via the internet and this platform, among others, but I ended up on pages that explain how you can convert a url to a url without capital letters. Now I want this too, but he has to open the files with capital letters in the file name.
So basically you want to open URL without capital letters and so it would work with capital letter filenames? Logically it's impossible. File names in most of operating systems are case sensitive. When you ask for text.txt
, it could refer to Text.txt
or TEXT.txt
or TEXT.TXT
or text.TXT
or different combinations... how the server would decide which one? Logically the thing that you are trying to do doesn't make any sense and won't work. URL rewriting is not only about what is being shown in URL bar, it affects the request itself.
The solution would be to change the URL in address bar with JavaScript
(after processing the request by server), but then imagine that a person would want to refresh the site - would wrap up to the same problem as above.