0

I’ve been doing a lot of research about uppercase and lowercase letters in folder and file names.

I have found many documented ways to convert uppercase characters to lowercase characters in folder and file names however not the other way around which is what I want to know how to do.

Example:

Assume folder is named Folder and file is named File on the server.

www.domain.com/folder/file covert to www.domain.com/Folder/File

The reason I got this idea is because Facebook converts lowercase letters to uppercase letters if that is how you named your username and I think it is a great process because it adds an enormous amount of character to your link.

I’m on Apache 1.3.42 so will need a solution that is not for the newer versions please.

Checkout my .htaccess file below, I’ve done a lot of SEO work to it as you can see:

AddType application/x-httpd-php .html

RewriteEngine On
RewriteBase /

#non www to www

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

#removing trailing slash

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1 [R=301,L]

#html

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.html [NC,L]

#index redirect

#directory remove index.html

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ 
RewriteRule ^index\.html$ http://www.arkiq.com/ [R=301,L]

#directory remove index 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\ HTTP/ 
RewriteRule ^index http://www.arkiq.com/ [R=301,L]

#sub-directory remove index.html

RewriteCond %{THE_REQUEST} /index\.html
RewriteRule ^(.*)/index\.html$ /$1 [R=301,L]

#sub-directory remove index

RewriteCond %{THE_REQUEST} /index
RewriteRule ^(.*)/index /$1 [R=301,L]

#remove .html

RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ /$1 [R=301,L]

Let me know if you know how to rewrite lowercase to uppercase as that would be superb.

Richard Morris
  • 31
  • 1
  • 2
  • 10
  • 1
    While I don't understand why you don't simply name your folders with uppercase letters?, this may help you: [How would I make Apache case insensitive using .htaccess?](http://stackoverflow.com/q/17223855) – Pekka Nov 15 '13 at 03:44
  • @Pekka웃 Hello Pekka, I just tried adding CheckSpelling on to my .htaccess file and got a 500 Internal Server Error. If I simply add an uppercase letter to any of my files or folders, then if somebody uses the more common lowercase they get a page not found error, so I need to rewrite this somehow without getting a 500 Internal Server Error. Thanks for trying Pekka. – Richard Morris Nov 15 '13 at 04:08
  • You're welcome. Your server's error log should contain a message with details about what goes wrong. – Pekka Nov 15 '13 at 04:12
  • @Pekka웃 The error message is file has no execute permission is all it says when I have CheckSpelling on in my .htaccess file so I deleted that command in order to bring my website back online. – Richard Morris Nov 15 '13 at 04:18
  • This is not a problem that should be solved by rewriting your urls. Just make sure the links in your webpage/application already have the uppercase characters in them. I suppose you can use a RewriteMap if you really need to. – Sumurai8 Nov 16 '13 at 11:10
  • @Sumurai8 No, simply programming uppercase letters is not an acceptable solution because many users type with lowercase letters and then would get a page not found error. Thus my links need to convert from lowercase to uppercase automatically, like Facebook does. Yes, a RewriteMap might be a suitable solution, what exactly would that look like? – Richard Morris Nov 17 '13 at 09:05
  • More information about RewriteMap's can be found [here](http://httpd.apache.org/docs/current/rewrite/rewritemap.html). You would need access to httpd.conf I believe. You could use it to match a lowercase character, use it as a lookupkey to get a uppercase character on that place. Again I am not sure how this exactly works in 1.4 – Sumurai8 Nov 18 '13 at 11:04
  • Otherwise you'll need 26 rules for 26 characters I think. – Sumurai8 Nov 18 '13 at 11:05
  • @Sumurai8 I would need to know exactly what to do before doing anything because if I break something on the server the server admin will charge me hundreds if not thousands of dollars to fix it which I am not willing to pay and is why I’m trying to do basic things myself. I believe I will consider this issue irresolvable. Thanks for your suggestions nevertheless. – Richard Morris Nov 18 '13 at 11:25

0 Answers0