CodeIgniter Forums
rewrite URL to lower case on godaddy - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: rewrite URL to lower case on godaddy (/showthread.php?tid=53606)



rewrite URL to lower case on godaddy - El Forum - 07-31-2012

[eluser]aniketharshe20[/eluser]
Hello,

I want that when someone types in the URL in uppercase then it should be converted to lower case.

In the facebook if you type upper case URL then also it converts it into lower case and then shows us the page.

How to do this in htaccess??


rewrite URL to lower case on godaddy - El Forum - 07-31-2012

[eluser]aniketharshe20[/eluser]
People please reply don't just view and go away....i need this


rewrite URL to lower case on godaddy - El Forum - 07-31-2012

[eluser]TWP Marketing[/eluser]
If I knew the answer I would post it. Instead, I did a websearch using "htaccess lower case" and found a huge number of responses to this question. Rather than repost one of them here I will give you the first one I found and you can read it for yourself. If that doesn't work there are many more hits if you do this search...
http://www.chrisabernethy.com/force-lower-case-urls-with-mod_rewrite/



rewrite URL to lower case on godaddy - El Forum - 07-31-2012

[eluser]aniketharshe20[/eluser]
i have tried this and it did not work for me...... :-(


rewrite URL to lower case on godaddy - El Forum - 07-31-2012

[eluser]CroNiX[/eluser]
You must not have the RewriteMap apache module installed, which is required to do what you are wanting via htaccess.

This can easily be done in a few lines at the top of your index.php, before CI loads.

Code:
$server_url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if ($server_url !== strtolower($server_url))
{
  header('Location: http://' . strtolower($server_url), TRUE, 301);
}
Then it should work on any server.


rewrite URL to lower case on godaddy - El Forum - 07-31-2012

[eluser]aniketharshe20[/eluser]
will this work if user changes URL from browser to uppercase then what??


rewrite URL to lower case on godaddy - El Forum - 07-31-2012

[eluser]CroNiX[/eluser]
Do you understand PHP? It isn't that much code and should be pretty self explanatory.


rewrite URL to lower case on godaddy - El Forum - 08-01-2012

[eluser]aniketharshe20[/eluser]
Thanks this worked....!!