Mod Rewrite URL to lowercase

by 4 replies
5
Hi guys,
I just wanted to ask how to go about modifying this code so that my URLs are rewritten in lowercase?

At the moment Ive got a mixture of uppercase and lowercase in my URLs and I believe its causing indexation issues.

Heres the code...

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ articles_view_article.php?permalink=$1
RewriteCond %{REQUEST_URI} rss.xml
RewriteRule (.*) rss.php
Thanks
#programming #lowercase #mod #rewrite #url
  • Try this

    RewriteRule ^(.*)$ articles_view_article.php?permalink=${tolower:$1}
  • Nope, that didnt work. Whole page errored out.
  • [DELETED]
  • Take a look at this blog John: Force Lower-Case URLs with mod_rewrite - Chris Abernethy . com

    You have to be able to access httpd.conf (Apache configuration) to be able to do stuff in your .htaccess which most shared server users dont.

    Otherwise you have to do the redirect in php level.

    Hope helps
  • yep. This ${tolower:$1} cannot be used in an .htaccess file.

    You've got to use either the main httpd.conf file or a custom one in conf.d/ folder

Next Topics on Trending Feed