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
Handling url letter case
Moderator: General Moderators
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Handling url letter case
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...
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
Thanks for your reply. The problem I am facing is I ma not able to resolvekaisellgren 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...
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...