Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Lowercase URLS

causing 500 errors

1:38 pm on Aug 15, 2012 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 25, 2004
votes: 0

Hi everyone!
I have swapped an old site on a cPanel host for a new one written in Zend Framework.

And as always, sods law kicked in and the job spec changed. Since the old sites google results were quite good, he wants the urls to be the same.

But if i browse to site.com/Contact instead of site.com/contact it doesn't work!

My current htaccess is like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule !\.(js|gif|jpg|png|css|txt)$ index.php

which is a typical zend framework .htaccess
I notice the line with NC means no case, but the dash means do not rewrite!
It is a dedicated server so i can access the apache configs

Any ideas?
7:02 pm on Aug 15, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
votes: 0

Here, the
flag has no effect.

matches all requests.

flag is used when the RegEx pattern is
and you want to accept any case request. Without the
flag in place, only
would match, but with the
flag added, requests for
would also match.

However, you should not normally use the
flag with a rewrite that directly serves content, use it only with a redirect. You should not allow multiple URLs to access the same content, and that's what the
flag would do when used with a rewrite that serves content.

The solution to your problem is fairly simple. When a request with any upper case characters is received, rewrite (that's rewrite not redirect) the request to a PHP script that uses
to deduce the new URL and the
directive to issue a 301 redirect to the new URL. This is now safe, content is now only served at lower case URLs, and the redirect retains traffic asking for upper case URLs.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members