On a website there is folder products/ and inside are php files with some Uppercase characters.
Example: http://www.example.com/products/BIT-Defendar.php
Now this urls exist for years and all around search engines. It was a mistake from the product manager.
But I want to fix this i want only lowercase URL’s.
Will this fix my issue? CheckSpelling On CheckCaseOnly On (1)
And whats different with mentioned above and: (2)
RewriteMap tolowercase int:tolower
RewriteRule ^(.*)$ ${tolowercase:$1}
If I use (1) then all works wither I request url lower cased or upper-cased (but will I have search engine problems?)
If I use (2) I have to rename all files inside of products/ folder to lowercase.
—- EDIT —-
When i use RewriteRule i get transferred to domain root if url is uppercase, if i use CheckSpelling and CheckCaseOnly then all fine.
I have tested with this and i get:
RewriteCond %{REQUEST_URI} [A-Z]
– This condition was met
RewriteRule (.*) ${tolowercase:$1} [R=301,L]
– This rule was met, the new url is http://www.example.com/${tolowercase:products/BIT-Defendar.php}
– Test are stopped, because of the R in your RewriteRule options. A redirect will be made with status code 301
My setup in httpd.conf:
<VirtualHost *:80>
RewriteMap tolowercase int:tolower
</VirtualHost>
Using the CheckSpelling and/or CheckCaseOnly directive may cause undesired results, as mentioned at the bottom here:
I would think it unwise to allow apache make the corrections for you, as you rely on apache to search directories and files for every single look up, whereas with the lowercase map, it puts you in full control and just creates strict standards.
I would recommend adding a flag
[R=301]which will inform search engines that this is the new file, and you won’t have any search engine related issues:You would have to rename your files, as they will no longer be recognized, but you can write a simple script to scan all files, and rename them as lowercase.