Page 1 of 1

Handling url letter case

Posted: Fri Mar 06, 2009 10:37 pm
by jayashree
I need to write the script to handle the url letter case.

My requirement is, what ever be the original case(uppper,lower,proper) I need to resolve it to lowercase url. Can I get the script for doing the same with htaccess.php ?

Thanks
Jayashree

Re: Handling url letter case

Posted: Sat Mar 07, 2009 7:51 am
by kaisellgren
Sorry, I did not understand.

Your website will load fine whether it is YOURSITE.COM or yoursite.com.

If you are talking about $_GET (e.g. site.com/file.php?data=SoMeDaTa) then you can force the case to be lowercase with strtolower($_GET['data']) or to uppercase with strtoupper(), but I did not understand what you wanted...

Re: Handling url letter case

Posted: Sun Mar 08, 2009 10:51 pm
by jayashree
kaisellgren wrote:Sorry, I did not understand.

Your website will load fine whether it is YOURSITE.COM or yoursite.com.

If you are talking about $_GET (e.g. site.com/file.php?data=SoMeDaTa) then you can force the case to be lowercase with strtolower($_GET['data']) or to uppercase with strtoupper(), but I did not understand what you wanted...
Thanks for your reply. The problem I am facing is I ma not able to resolve
yoursite.com/Welcome.php to yoursite.com/welcome.php. I tried


# Skip this entire section if no uppercase letters in requested URL
RewriteRule ![A-Z] - [S=28]
# Else rewrite one of each uppercase letter to lowercase
RewriteRule ^([^A]*)A(.*)$ /$1a$2
RewriteRule ^([^B]*)B(.*)$ /$1b$2
RewriteRule ^([^C]*)C(.*)$ /$1c$2
...
RewriteRule ^([^Z]*)Z(.*)$ /$1z$2
# If more uppercase letters remain, re-invoke .htaccess and start over
RewriteRule [A-Z] - [N]
# Else do a 301 redirect to the all-lowercase URL
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

in my .htaccess file. It converts yoursite.com/Welcome.php to yoursite.com///welcome.php
but I am getting server error. Can you help me in fixing this...