Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

Soft 404 Errors


  • Please log in to reply
16 replies to this topic

#1 mmassop

mmassop

    HR 1

  • Members
  • Pip
  • 8 posts
  • Location:The Netherlands

Posted 16 July 2012 - 07:51 AM

Hi all,

I am new to this forum, I hope people can help me here.


I have a website with family trees, with over 1 million names (with their own page). It always was on Google's first page, but dropped a lot after the panda update. I have already changed a lot, determined to beat it .

I saw in Google webmster that it found a lot of soft 404 errors on my site (in which google says: the page doesn't exist and the server doesn't return a 404-error). The urls giving this error are often pages of names which are deleted from the family trees. So the page itself does exist (for example person.php), but the person itself is deleted (person.php?pid=34 -> person 34 was deleted) so there is no information on the page). So I put this code on the page:

if($name == "")

{
Header( "HTTP/1.1 404");
Header( "Location: ../../main.php?pagina=404");
exit;
}




I've read that putting a redirect in .htaccess is more common, but because I am not the one deleting the names, I think this is the more logical place for me, because putting a 404 error on a deleted name is automated.

I thought this was the answer, because when I click on the link I can see my own 404-page. But Google still gives the soft-404 error, so he doesn't see it as a proper 404?

If I put the link on the page 'fetch as google-bot' I get this:

HTTP/1.1 302 Found
Date: Sun, 15 Jul 2012 13:34:26 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.1.6
Set-Cookie: PHPSESSID=9mv70a1ugb585r5i4gt5t0jcf2; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: ../../main.php?pagina=404
Content-Length: 40
Connection: close
Content-Type: text/html

<!-- Er wordt een verbinding gemaakt -->

What do I have to change for Google not to put these error in the list? Any help would be greatly appreciated.

Margaret

#2 qwerty

qwerty

    HR 10

  • Moderator
  • 8,619 posts
  • Location:Somerville, MA

Posted 16 July 2012 - 10:26 AM

It's clear that, while both Googlebot and you are ending up on the 404 page, the header response code the bot is getting is a 302 rather than a 404. I'm no script guy, so I can't guarantee that this is the reason, but I searched around a bit, checked 5 or 6 different sources, and every one of them specified
<?php
header("HTTP/1.0 404 Not Found");
?>
Some used HTTP 1.1, and one of them indicated that either would work and it just depended on which version you'd used on the rest of the site, but all of them stipulated "404 Not Found" instead of just "404". I don't know if changing that will make a difference, but I think it's worth trying unless and until someone else posts that I don't know what I'm talking about (because I don't).

Apart from that, I'm not sure if using a relative URL for the location of the 404 page is the right way to go, although it seems to be working for you when you test it. Have you tried requesting a nonexistent page at a URL buried deep within multiple levels of (nonexistent) subdirectories and seeing if you still get the 404 page?

I think you might be better off using .htaccess to point to the URL to be displayed in the event of a 404 response and just using the php to set that response. But again, this is not my field of expertise -- not even close :)

#3 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 6,946 posts
  • Location:Blackpool UK

Posted 16 July 2012 - 01:20 PM

By sending a location header AFTER the 404 header you are overriding the 404 status with a temporary redirect which is a 302 status code.

#4 piskie

piskie

    HR 7

  • Active Members
  • PipPipPipPipPipPipPip
  • 1,098 posts
  • Location:Cornwall

Posted 16 July 2012 - 02:27 PM

Why not send to a mini site map sort of page if name does not exist.

#5 mmassop

mmassop

    HR 1

  • Members
  • Pip
  • 8 posts
  • Location:The Netherlands

Posted 16 July 2012 - 04:23 PM

Okay, I get it! The right code should be:

if(name=="")
{
Header( "HTTP/1.1 404 Not Found");
exit;
}

This should work because in my .htaccess it is stated that the webserver should serve my personal 404-page.

I will let you know if this works for Google as well.

Thanks a lot for the quick replies!

#6 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 6,946 posts
  • Location:Blackpool UK

Posted 16 July 2012 - 06:59 PM

Why not send to a mini site map sort of page if name does not exist.


Provided that the URL returns a 404 or a 410 response the document content can be anything at all.

#7 piskie

piskie

    HR 7

  • Active Members
  • PipPipPipPipPipPipPip
  • 1,098 posts
  • Location:Cornwall

Posted 17 July 2012 - 12:16 PM

I would make a person.php page that was a more or less mini map so that when no name or ID was specified, it displayed where to go to look for relevant stuff.

On the lines of:
"The information that you have requested is no longer available. These pages may help you find etc etc"

Edited by piskie, 17 July 2012 - 12:18 PM.


#8 mmassop

mmassop

    HR 1

  • Members
  • Pip
  • 8 posts
  • Location:The Netherlands

Posted 17 July 2012 - 03:39 PM

Ah now I understand now what were saying. But in fact, my personal 404 page looks already like that, although it is a bit more generic.

#9 mmassop

mmassop

    HR 1

  • Members
  • Pip
  • 8 posts
  • Location:The Netherlands

Posted 12 August 2012 - 01:43 PM

Hi guys,

I'm back :(. For some reason I am still not getting the right 404 page all the time. I hope you can help me again.

This is the code in .htaccess:

ErrorDocument 404 http://www.mylink.nl/main.php?pagina=404

And this in map/template.php:


if($name == "")
{
header("HTTP/1.1 404 Not Found");
exit;
}

if I go to map/template.php?name=existingname everything works as it should.
if I go to map/notexistingfile.php?name=existingname I am getting the 404 error page as I should.

But if I go to map/template.php?name=notexistingname I am getting a white page.
If I echo something just before header() it is echoed, so the code is being activated.
If I use the google bot in google's webmaster area I can see a 302 is returned instead of a 404.

And if I go to map/template.php?name=notexistingname&someothervariables I also get a white page.

If I echo something just before header() it is echoed, so the code is being activated.
If I use the google bot in google's webmaster area I can a 404 error is given, but the right page isn't show.

Does anyone here see what I am doing wrong?
Thanks in advance.

#10 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 6,946 posts
  • Location:Blackpool UK

Posted 13 August 2012 - 08:26 AM

That code is never going to work because at that point "pagina" is ALWAYS "404".

The requested URL is passed to a custom error page as a querystring

Use PHP to get $_SERVER['QUERY_STRING'] it is usually formatted as 404;original-requested-URL just strip out the bits you don't need and redirect to what is left.

#11 mmassop

mmassop

    HR 1

  • Members
  • Pip
  • 8 posts
  • Location:The Netherlands

Posted 13 August 2012 - 08:51 AM

Sorry Chrishirst, you lost me somewhere in your message.

Do I understand correctly that I can't use a php variable in my .htaccess?

I have now changed my custom error page from a php-file to a html-file

ErrorDocument 404 http://www.uwstamboomonline.nl/404.html

But it didn't solve the problem that I am not getting a 404 page custom or general) when I put in not existingnames.

#12 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 6,946 posts
  • Location:Blackpool UK

Posted 14 August 2012 - 09:06 AM

Do I understand correctly that I can't use a php variable in my .htaccess?

Correct. You can use some Apache environment variables though.

I have now changed my custom error page from a php-file to a html-file

ErrorDocument 404 http://www.uwstamboomonline.nl/404.html

But it didn't solve the problem that I am not getting a 404 page custom or general) when I put in not existingnames.

What are you getting?

#13 mmassop

mmassop

    HR 1

  • Members
  • Pip
  • 8 posts
  • Location:The Netherlands

Posted 14 August 2012 - 09:47 AM

Still the same. I will give you some live examples, maybe that will make things clearer:

This is a good page: www.uwstamboomonline.nl/passie/sites/template.php?pid=1658

This is a not existing page:
www.uwstamboomonline.nl/passie/sites/template.php?pid=1658
-> it gives my custom error page
www.uwstamboomonline.nl/404.html

Then when I use the right page but a not existing pid the code should be triggered, but it is not, it gives a white page:
www.uwstamboomonline.nl/passie/sites/template.php?pid=16588

This is the code:
if($kid == "" OR $pid == "")
{
header("HTTP/1.1 410 Gone");
exit;
}

I changed the 404 to 410 (because most of those pages are indeed deleted pid's), but they both do not work, if I change it to a 302 or 301 it does work.

I could use a 302 redirect to my error page, but the problem I am trying to solve is that in my google webmasters there are a lot of errors saying something like 'the url does not exist and your server does not return a 404-error'. If they say that, than it should be possible to generate a 404 error, shouldn't it?

Edited by Jill, 14 August 2012 - 12:59 PM.
removed live links


#14 mmassop

mmassop

    HR 1

  • Members
  • Pip
  • 8 posts
  • Location:The Netherlands

Posted 14 August 2012 - 01:04 PM

Sorry for posting live links. I thought it would make things clearer, because some how my message with fake links seems not clear enough. I won't do it again :).

The only problem is now is that after Jill's editing one of the links is altered. The not-existing page was www.uwstamboomonline.nl/passie/sites/fakepage.php -> that one gives the custom error page.

#15 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 6,946 posts
  • Location:Blackpool UK

Posted 15 August 2012 - 01:34 PM

Then when I use the right page but a not existing pid the code should be triggered, but it is not, it gives a white page:
www.uwstamboomonline.nl/passie/sites/template.php?pid=16588

This is the code:

if($kid == "" OR $pid == "")
{
header("HTTP/1.1 410 Gone");
exit;
}

All that code will do is send a HTTP header and then stop. it will NOT serve out the 410 document because the SERVER has not triggered the response, it has been done by PHP. If you want any content to be shown to real users YOU have to provide it in the same document.

The documents referenced in an ErrorDocument directive are only shown when the server handles the error.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

SPAM FREE FORUM!
 
If you are just registering to spam,
don't bother. You will be wasting your
time as your spam will never see the
light of day!