Welcome to WebmasterWorld Guest from 54.227.127.109

Forum Moderators: phranque

Message Too Old, No Replies

Soft 404 errors on expired pages

     
7:34 am on Apr 13, 2016 (gmt 0)

Preferred Member

Top Contributors Of The Month

joined:Mar 15, 2013
posts: 544
votes: 46


I have a site that features classified ads. After a predetermined period, those ads expire. If you view the page after they expire, PHP redirects you back to the main page:


if (
!$expiration ||
$expiration < $today
) { header("Location:$home/?q=notfound"); exit; }


Then, of course, $home does something like this (just typed for this post):

if ($_GET['q'] == 'notfound') echo "Error message";


Beginning on March 15, though, Google Webmaster Tools started picking up these expired pages as "soft 404 errors", and it shows literally thousands of these errors.

What's the best way to fix this for Google without being penalized by Google, and be seamless to my users? My initial thought was to do this, but I'm not sure if it's the best way:


if (
!$expiration ||
$expiration < $today
) {
header(“HTTP/1.1 301 Moved Permanently”);
header("Location:$home/?q=notfound");
exit;
}
2:32 pm on Apr 13, 2016 (gmt 0)

Administrator from US 

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

joined:Dec 27, 2006
posts:3468
votes: 193


That won't change the soft 404s unfortunately because it will continue to show unrelated contents for the URL requested. Where you have:
header(“HTTP/1.1 301 Moved Permanently”);
header("Location:$home/?q=notfound");
exit;

you could try using:
header("HTTP/1.0 404 Not Found");
require("your 404 page");
exit;

replacing the "your 404 page" with the actual page name. Maybe you could set up your 404 page to capture and echo the query with an Expired notice and a link back to related pages.

(Note: my 'code' is not for copy paste - I don't know beans about php, excuse any guessing errors, please)
7:34 pm on Apr 13, 2016 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:14326
votes: 563


Seems like 410 would be even better. You can show the same physical page, but the numerical response may help.
9:09 pm on Apr 13, 2016 (gmt 0)

Preferred Member

Top Contributors Of The Month

joined:Mar 15, 2013
posts: 544
votes: 46


Lucy, do you mean that I could still redirect like my original if I use "410 Gone", or that I should still import $home using require() the way that not2easy suggested?
9:24 pm on Apr 13, 2016 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:14326
votes: 563


I mean that in not2easy's suggestion, the 404 header could be replaced with the 410 header ("410 Gone", I suppose, unless php calls it by some other name). Everything else can remain as she said-- including sending out your (physical) 404 page if you don't feel like creating a separate 410 page.

If you get a significant number of human requests for expired content, then a custom 410 page might be appropriate anyway-- "I used to have it but it's gone" sounds friendlier than "I don't know what you're talking about"-- but otherwise there's no need.
2:52 am on Apr 14, 2016 (gmt 0)

Senior Member from US 

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

joined:Nov 29, 2005
posts:7921
votes: 562


Classified ads (the usual definition) generally have a fixed life unless open ended. When they die they should actually die a 410.
4:05 am on Apr 14, 2016 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:14326
votes: 563


Also: I'm not sure "Require" is warranted here. I mean, you'd want to send out the 404/410 response even if your 404 page has unaccountably gone walkabout.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members