php - Issues with re-directing, need to force lowercase in url -


i want force lowercase gets, using disqus.com commenting system, , serve pages based on get, disqus.com not differentiate

 http://www.mydomain.com/words/?w=hej  

and

 http://www.mydomain.com/words/?w=hej  

it serves comments different pages.

what best way fix issue? cannot seem use .htcacess have read, , dont want serve 404 if uppercase, there other way force lowercase in url ?

edit 2:

i tried own solution

$page = urldecode($_get['w']); $lowerpage = strtolower($page);  if ($page !== $lowerpage) {       header("location: http://www.mydomain.com/words/?w=". $lowerpage);      die(); } 

works fine in firefox, google adds delay on redirect though - anyway testing solution below now.

here 1 way can done in apache mod_rewrite.

  1. first enable mod_rewrite , .htaccess through httpd.conf.

  2. lowercasing url need add line in httpd.conf , bounce apache process:

    rewritemap lc int:tolower

  3. then put code in .htaccess under document_root directory:

once verify working change r=302 r=301.

options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase /  rewriterule ^([^a-z]*[a-z].*)$ /${lc:$1} [r=302,l] 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -