Mod Rewrite URL to lowercase

4 replies
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...

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
#lowercase #mod #rewrite #url
  • Profile picture of the author codefish
    Try this

    RewriteRule ^(.*)$ articles_view_article.php?permalink=${tolower:$1}
    {{ DiscussionBoard.errors[6241852].message }}
  • Profile picture of the author John Romaine
    Nope, that didnt work. Whole page errored out.

    BS free SEO services, training and advice - SEO Point

    {{ DiscussionBoard.errors[6241936].message }}
  • Profile picture of the author Fahmzie
    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
    {{ DiscussionBoard.errors[6243267].message }}
  • Profile picture of the author lordspace
    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

    Are you using WordPress? Have you tried qSandbox yet?

    {{ DiscussionBoard.errors[6245426].message }}

Trending Topics