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.
first enable mod_rewrite , .htaccess through httpd.conf.
lowercasing url need add line in httpd.conf , bounce apache process:
rewritemap lc int:tolower
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
Post a Comment