homepage Welcome to WebmasterWorld Guest from 54.196.197.153
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Google / Google SEO News and Discussion
Forum Library, Charter, Moderators: Robert Charlton & aakk9999 & brotherhood of lan & goodroi

Google SEO News and Discussion Forum

    
Is my internal redirect harming rankings?
Noddegamra




msg:4188575
 10:27 am on Aug 18, 2010 (gmt 0)

Hi,

I have a website that works like this:

I have a script called a content handler that checks the URL entered. So, when people go to my root url (www.domain.com for example) it defaults to a page using the following code:


else
{
// Show Default Page
$section = "home";
$page = "index";
header("Location: $global_site_url/$section/$page.html");
}


In this case, when people go to www.domain.com it goes to www.domain.com/home/index.html which is the home page. Other pages/urls go to their respective areas.

So.. is this harming my site rankings? Is it doing weird things in search engines eyes for my root domain?

My .htaccess file contains the following code:


Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^/]+)/([^/]+).html index.php?section=$1&page=$2 [NC]


If someone goes to a page directly (as in the proper file structure such as www.domain.com/products/product.php) I use this


if(!$page)
{
$global_site_url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."index.html";
header("Location: $global_site_url");
}


Which may also be harming rankings?

I'd just like a second opinion really to see if I am doing things ok or making a real huge mistake.

Thanks

 

tedster




msg:4188721
 4:25 pm on Aug 18, 2010 (gmt 0)

This does seem like it night be a problem. First, if you absolutely must redirect the domain root for some reason, you should use a 302 status redirect. But if you are redirecting any internal URL, then use a 301.

So the first thing I'd suggest is using a header checker to see what http status is being returned for the original request.

Noddegamra




msg:4189107
 9:25 am on Aug 19, 2010 (gmt 0)

Hi. Thanks for your reply.

When using an online tool to check the root domain headers (I don't know if I can name which tool/site I'm using), this is part of the feedback/response I get:


HTTP/1.1 200 OK
Connection: close
Date: Thu, 19 Aug 2010 09:23:38 GMT
Server: Apache
Content-Language: EN-GB
Content-Type: text/html
Content-Type: text/html; charset=iso-8859-1
Client-Response-Num: 1
Client-Transfer-Encoding: chunked


Using another tool to check links and popular pages said that the www.domain.com had a header status for 302, but www.domain.com/home/index.html had a status of 200.

So, will the search engines view it as 200 or 302? I'm ranking pretty well in searches, but I don't know if this is preventing me ranking even higher.

tedster




msg:4189196
 12:46 pm on Aug 19, 2010 (gmt 0)

this is part of the feedback/response I get

The whole response matters - every URL that the server and user agent "discuss" when trying to resolve a request. In your case, it looks like you have a 302 redirect status on a request for your www hostname. Then that redirect goes to an internal URL that does resolve with a 200 OK.

Since the redirect is from the domain root, a 302 is recommended. I would not think this redirect is causing you any ranking trouble.

Noddegamra




msg:4189218
 1:21 pm on Aug 19, 2010 (gmt 0)

That's brilliant news. Thank you for looking into this for me.

jdMorgan




msg:4189253
 1:54 pm on Aug 19, 2010 (gmt 0)

Even if most search engines do figure out your intent, these external redirects nevertheless appear to be unnecessary, slow the "user experience" by resulting in two client-server transactions per "user" request, and create double log entries (one redirect, one 200-OK) for each of those requests, which may inflate and affect the usefulness of your site's "stats."

A better approach would be to avoid these external redirects entirely by replacing them with additional internal-rewrite rules in your .htaccess file or --if you prefer doing things with PHP-- changing the PHP code to "include and then echo the proper page content" instead of redirecting the client.

In PHP, sending a "Location" header to the client results in a 302-Found redirect.
In PHP, Sending a "Location" header plus a server status of 301 gives a 301-Moved Permanently redirect.
In PHP, "including" a file and then sending that file's contents to the client is essentially equivalent to an internal rewrite (URL-to-internal-filepath translation) in .htaccess using mod_rewrite.

I agree that you should never allow the situation where you link to a URL that is always 301-redirected, while linking to a URL that is always 302-redirected is a bit more "forgiveable" in search engines' eyes (and many fairly-big sites do this). But really, you should never redirect the client unless the requested URL is actually wrong in some way -- and never link to a "wrong" URL from your own site, regardless of the redirect code returned.

I defer to Tedster's learned judgment on the "level of SEO harm" here, but unnecessary redirects certainly cannot be good for a site.

Jim

suratmedia




msg:4189259
 1:59 pm on Aug 19, 2010 (gmt 0)

php header function by default do 302 redirect.

Use

header("Location: $global_site_url/$section/$page.html",TRUE,301);

for 301 redirect.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Google / Google SEO News and Discussion
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved