#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    6
    Rep Power
    0

    302 and 410 gone issue


    302 and 410 response issue on sindicated content
    OK! I have a question for you really smart guys out there.

    I have a real estate website with a plugin that create a separate page for every new property as they get listed for sale. As these properties sell the plugin automatically removes the listing and when search engines (Google) tries to find these already indexed pages it shows a soft 404 error in my webmaster tools.

    These pages are gone so I want to return a 410 code. Now remember this is a plugin so I went into my wordpress into my plugin editor and found the section that applies to these pages and put in an if statement saying that basically if the page goes away return a 410 gone. However when I run a check on the pages in question I show a 302 response code. I can successfully change it to a 301 and it works however the 410 gone is not working.

    I know people have been nailed from an SEO perpective in the past for redirecting these pages. So should I 301 these or 410 them. If 410 what am I doing wrong? Below is the code from the plugin that I edited to try to change to a 410 gone. Thanks in advance.


    if ($listing != null) {
    header("HTTP/1.0 410 Gone");
    header( 'Location: (my url goes here) ) ;
    $fmc_special_page_caught['page-title'] = flexmlsConnect::make_nice_address_title($listing);
    $fmc_special_page_caught['post-title'] = flexmlsConnect::make_nice_address_title($listing);
    $fmc_special_page_caught['page-url'] = flexmlsConnect::make_nice_address_url($listing);
    }
    else {
    header("HTTP/1.0 410 Gone");
    header( 'Location: (my URL goes here) ) ;
    $fmc_special_page_caught['page-title'] = "Listing Not Available";
    $fmc_special_page_caught['post-title'] = "Listing Not Available";
    // $fmc_special_page_caught['page-url'] = flexmlsConnect::make_nice_address_url($listing);
    }
    }
  2. #2
  3. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4124
    you cannot send TWO http response codes to ONE http request - the php+webserver probably agree to send the last one that was issued

    Do one of the following

    1 - keep the page
    2 - return a 404 or 410
    3 - 301 to another page

    Personally, I'd go with option 1 but edit the content to show sold or option 3 - redirect to an archive page

    IMO "410 gone" is best left for use with ReSTful applications working behind the scenes
    Last edited by Northie; June 27th, 2012 at 05:13 PM.
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    6
    Rep Power
    0

    Issue resolved


    Ok i fixed the coding issue. I changed the header response to header("Status: 404 Not Found");
    instead of header("HTTP/1.0 404 Not Found");

    The plugin initially came with a page saying sold. I redirected it to a custom sold page on my site vs there sold page.

    If this info is being pulled from their server how does Google look at a 301? Who gets penalized my server or theirs.
  6. #4
  7. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4124
    The more correct status code is

    PHP Code:
    header("HTTP/1.1 404 Not Found"); 
    don't forget to die() afterwards;

    If this info is being pulled from their server how does Google look at a 301? Who gets penalized my server or theirs.
    What? Maybe I missed something, who are "they" and why would anyone be penalised?
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    6
    Rep Power
    0
    I was referring to the plugins server/database. Maybe I am misunderstand how this all works.

    I have read on forums of people getting penalized by Google for abusing the 301 redirects when they should be using a 410 or 404.
  10. #6
  11. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    don't forget to die() afterwards;
    Actually if you're not redirecting the user don't die() after the header call.

    I have read on forums of people getting penalized by Google for abusing the 301 redirects when they should be using a 410 or 404.
    Nobody except Google really understands how Google ranks sites, and I'm pretty certain that everybody who works for Google is forbidden from talking about it. Their algorithms are constantly changing and SEO people are constantly trying to guess what those algorithms actually are.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo