Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

upper to lower case redirect

5:31 pm on Jan 6, 2011 (gmt 0)

5+ Year Member

I have studied the forum to redirect upper case url to lower case but in my situation i want to convert a string $6 of my url and not entire url:

RewriteRule ^[0-9]+-PG[0-9]*-[0-9]*-V[^/]*/P[~A-Za-z0-9]*-S([^/]*) /$6.htm [R=301,L]

I want to convert $6 to lowercase and redirect. Please help me out :)
11:14 pm on Jan 6, 2011 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

I posted that code in our Library in January, 1997: [webmasterworld.com...] :)

9:46 am on Jan 7, 2011 (gmt 0)

5+ Year Member

What if i use php header redirect:
header("Location: $lowercase_url", true, 301);

Does it make difference to Google if we are doing 301 redirects by .htaccess or by header? Will it transfer PR link juice exactly the same way?
3:21 pm on Jan 7, 2011 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Either way will work fine -- Google cannot see what you do inside your server... as long as you code it correctly.

To handle frequently-occurring events that will persist over time, using .htaccess or server-config-file code is often better from an efficiency standpoint. But for infrequently-occurring events, or those which will stop happening after a short time, it really does not matter.

In this case, I presume that you have corrected all uppercase links on your own site's pages, so the 301s will not be invoked very frequently after a few months (that is, after the search engines see the 301 redirects for awhile). And since it is far easier to do case-correction with PHP that it is by using mod_rewrite in .htaccess, I would judge the PHP option to be a better one in this case.

For those who have server-config-file access, doing case-correction by using a RewriteMap and calling the "tolower" function of the operating system would be more efficient. But if you're on shared hosting with no server configuration access, again the PHP option for case-correction is better.

As with all code that invokes server response codes, be sure to thoroughly check your implementation using a server headers checker to make sure that the correct response is returned in all cases, and that a single client HTTP request never results in more than one redirect or error response. Browser add-ons like the Live HTTP Headers add-on for Firefox and Mozilla-based browsers --or similar add-ons for Mozilla and/or other browsers-- are useful for this and are a part of the basic Webmaster toolkit.