Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Configure 404 error page

(Page 1 of 2)
> >
Quote Reply
Configure 404 error page
my site runs using htaccess file with RewriteEngine on

how do I configure 404 error page that provides correct 404 error response?

at present any 'detailed' pages that are no longer exist return an error page with a message like this:

Unable to find detailed page: 'Italy/B_B_in_Costiera_9149.html'


the deleted detailed pages that display this message are still being crawled by Google and reported as soft 404 and crawl errors


thanks
Colin Thompson
Quote Reply
Re: [colintho] Configure 404 error page In reply to
TBH, I'm not sure there is a lot you can do. I believe when a detailed page doesn't exist, it DOES return a 404 status - but also prints out a page (thus why google treats it as a "soft 404")

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Configure 404 error page In reply to
from Google webmaster tools this is showing http status of 200

Fetch as Google
This is how Googlebot fetched the page.
URL: http://www.***********.com/Italy/B_B_in_Costiera_9149.html
Date: Thursday, June 28, 2012 2:28:53 AM PDT
Googlebot Type: Web
Download Time (in milliseconds): 716
HTTP/1.1 200 OK Date: Thu, 28 Jun 2012 09:28:53 GMT Server: Apache Keep-Alive: timeout=2, max=200 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html
Colin Thompson
Quote Reply
Re: [colintho] Configure 404 error page In reply to
Ah ok maybe it doesn't then. Still, not sure there is a huge amount you can do for it. Even if you were to pass it was a 404, it would still have to display some kinda content (or you would get a 500 IS error)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Configure 404 error page In reply to
Hi Andy

whilst I was trying to find some info about this, I found this page on GT website http://www.gossamer-threads.com/...sql2/page.cgi?t=null

which returns a 404 status when checked with http://www.websiteoptimization.com/services/analyze/

can something like this be done?

Thanks
Colin Thompson
Quote Reply
Re: [colintho] Configure 404 error page In reply to
Hi colintho,

As far as I remember this should be fixed in the most updated version of GLinks. It was by my request Adrian fixed unexisting detailed pages to return proper 404 response in the headers long time ago!

Can you check what your site returns when you request non existing Link ID?

As for setting the common 404 page there is a way either by modifying .htaccess or in httpd.conf itself.

About soft 404 i receive some of those too, but according to Google soft 404 is set for example if for some reason google-bot was unable to connect to your site, even if the page in question really exist.

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Configure 404 error page In reply to
I changed the link ID for the 'old / deleted' detailed page which was originally link ID 9149 to test how [/size]Fetch as Google for 'non existent link ID 9148 returns same error page with 200 status[/font]

GLinks Version: 3.2.0

I may need to update to version 3.3.0 ?
Colin Thompson

Last edited by:

colintho: Jun 28, 2012, 12:45 PM
Quote Reply
Re: [colintho] Configure 404 error page In reply to
Nope it was fixed in 3.2.0!

What Setup > Build options > dynamic_404_status says?

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Configure 404 error page In reply to
Hi Boris

dynamic_404_status = yes
Colin Thompson
Quote Reply
Re: [colintho] Configure 404 error page In reply to
I think dynamic 404 is aimed for category pages? In Build.pm, I see: (in sub build_detailed { )

Code:
my $link = shift;
if (ref $link ne 'HASH') {
return Links::SiteHTML::display(error => { error => Links::language('BUILD_DETAILED_ARGS', $link) });
}

In fact, I can't see any reference to "404" in that file at all (Links/Build.pm)

You could try tweaking it to:
Code:
if (ref $link ne 'HASH') {
print "Status: 404" . $GT::CGI::EOL;
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [colintho] Configure 404 error page In reply to
Hi Collin,

I was wrong it is indeed added as fix in GLinks 3.3.0.

Quote:
Added dynamic 404 status to detailed pages as well

This is in official announcement: http://www.gossamer-threads.com/...0_Released!_P305655/

I think is not a bad idea to upgrade :)

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [Andy] Configure 404 error page In reply to
Andy,

Quote:
I think dynamic 404 is aimed for category pages?

In 3.2.0 yes, it has beed added to detailed as well in 3.3.0.

You can find it in Links/User/Page.pm not in the Build.pm

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Configure 404 error page In reply to
Ah sorry, yes your right:

Code:
if (!$link) {
print "Status: 404" . $GT::CGI::EOL if $CFG->{dynamic_404_status};
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDDETAIL', $page) });
return;
}

Serves me right doing the reply before my first coffee Whistle

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Configure 404 error page In reply to
Many Thanks to both Andy & Boris for helping me with this.

error page for expired / deleted listing now return 404 status

Thanks
Colin Thompson
Quote Reply
Re: [colintho] Configure 404 error page In reply to
Cool =)

Happy to hear that Colin.

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [colintho] Configure 404 error page In reply to
colintho wrote:
Many Thanks to both Andy & Boris for helping me with this.

error page for expired / deleted listing now return 404 status

Thanks

Hi Colintho,
did you do the update to 3.30 or did you change the code like andy says...???
Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Configure 404 error page In reply to
updated the code as suggested by Andy
Colin Thompson
Quote Reply
Re: [Andy] Configure 404 error page In reply to
Andy wrote:

Code:
if (!$link) {
print "Status: 404" . $GT::CGI::EOL if $CFG->{dynamic_404_status};
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDDETAIL', $page) });
return;
}

Hi Colin,
I think you mean the code above. Where in page.pm did you put it?
Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Configure 404 error page In reply to
Matthias,

Scroll down to the very end of Page.pm (line 242) and change:

Code:
if (!$link) {
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDDETAIL', $page) });
return;
}

to:

Code:
if (!$link) {
print "Status: 404" . $GT::CGI::EOL if $CFG->{dynamic_404_status};
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('PAGE_INVALIDDETAIL', $page) });
return;
}

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Configure 404 error page In reply to
Thanks Boris, Andy and Colin,
the code change in page.pm seems to work in some cases but not in all.

My URLs to detailpages are build like this
Code:
%Title%_D%ID%
and the htaccess for the detailpages look like this

Code:
# detailed pages rewrite
# ID RewriteRule ^Detailed/([0-9]+)\.html$ /cgi-bin/unterricht/page.cgi?g=Detailed/$1.html [L]
# Detailed Folder RewriteRule ^Detailed/.*_([0-9]+)\.html$ /cgi-bin/unterricht/page.cgi?g=Detailed/$1.html [L]
RewriteRule .*_D([0-9]+)\.html$ /cgi-bin/unterricht/page.cgi?g=Detailed/$1.html [L]
RewriteRule ^.*L([0-9]+)/(.*)\.html$ /cgi-bin/unterricht/page.cgi?g=Detailed/$1.html [L]
RewriteRule ^.*L([0-9]+)/?$ /cgi-bin/unterricht/page.cgi?g=Detailed/$1.html [L]

So my URL look like this
TITLE_D12345.html

When I change TITLE I'm redirected to the glinks error message?
When I change the ID 12345 to something else I' redirected to the glinks error message?

When I change or delete _D I get the 404 error message
When I change .html to something else I get the 404 error message

The solution must be in the htaccess code above, but where?
Here is a live example:
http://www.gpaed.de/Das_Lineal_D16993.html

Thanks

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Configure 404 error page In reply to
Matthias70 wrote:
When I change TITLE I'm redirected to the glinks error message?
No! If you change the title, you'll get the detailed page for the provided ID.
For example: http://www.gpaed.de/WrongTitle_D16993.html
In this case the Title may be wrong but the ID is still valid and GLinks would show the right page for it.

Matthias70 wrote:
When I change the ID 12345 to something else I' redirected to the glinks error message?
If you change the ID, GLinks will show the page for that ID and would print 404 headers only if the provided ID doesn't exist in the DB.

Matthias70 wrote:
When I change or delete _D I get the 404 error message
You'll get the default configured 404 from apache because this doesn't match any rewrite rule.

Matthias70 wrote:
When I change .html to something else I get the 404 error message
You'll get the default configured 404 from apache because this doesn't match any rewrite rule.

Matthias70 wrote:
The solution must be in the htaccess code above, but where?
I'm afraid it's not that simple. As you can see from the rewrite rules, GLinks takes only the ID from the whole URL and works with that. It doesn't takes back in to account what you put in build_detail_format when prints the detail page to the visitor.

Unless GT is willing to provide fix/patch for GLinks there is no easy fix for that.
Still, the cases in which your GLinks install would receive wrong %Title%_D%ID% combination should be very rare!

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Configure 404 error page In reply to
eupos wrote:
Matthias70 wrote:
When I change the ID 12345 to something else I' redirected to the glinks error message?

If you change the ID, GLinks will show the page for that ID and would print 404 headers only if the provided ID doesn't exist in the DB.

Thanks Boris,
for your good explanation, but in the part above there is the problem.

Even when I change the ID to an ID that does not exist, I get NO 404 error, but the glinks error.
So when I delete a link, google thinks it is still there....?

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Configure 404 error page In reply to
Hi Matthias,

Matthias70 wrote:
Even when I change the ID to an ID that does not exist, I get NO 404 error, but the glinks error.
So when I delete a link, google thinks it is still there....?

Ah yes I forgot to explain that :)
After the changes, your site now returns the proper header!!!
When you pass the non existing ID, your GLinks returns error message with the header: "Status Code:404 Not Found" instead of "200 OK". You can check that by yourself as well.

And this is the only thing Google Bot cares. When it receives "Status Code:404 Not Found" in the headers content and title of the page are irrelevant.

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Configure 404 error page In reply to
Hi Boris,
now I understand. I was searching for changes in the source code....
You are right, now wrong detailpages are showing a 404 status in the header Cool
Thanks a lot!

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Configure 404 error page In reply to
You are welcome :)

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
> >