homepage Welcome to WebmasterWorld Guest from 50.17.162.174
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
upper to lower case redirect
fahad direct




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

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 :)

 

jdMorgan




msg:4250083
 11:14 pm on Jan 6, 2011 (gmt 0)

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

Jim

fahad direct




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

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?

jdMorgan




msg:4250299
 3:21 pm on Jan 7, 2011 (gmt 0)

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.

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved