Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Aiheen aloitti: destalk - elokuu 01, 2006, 01:49:56 IP

Otsikko: Deleted threads to throw a 404 header
Kirjoitti: destalk - elokuu 01, 2006, 01:49:56 IP
It would be nice if threads that no longer exist (even if they have been moved to a 'deleted' board) would throw a 404 error to spiders and also for users (although it would be nice to customise the 404 page for 'real' visitors). Otherwise the pages still get listed in search engines and simply waste visitors time.

It just seems the right thing to do. ;)

Otsikko: Re: Deleted threads to throw a 404 header
Kirjoitti: ryanbsoftware - elokuu 04, 2006, 09:19:37 IP
so you want the following error given if you try to access a board or topic non-existant to non-viewable to you to be customizable?

LainaaAn Error Has Occurred!
The topic or board you are looking for appears to be either missing or off limits to you. 

I believe you can customize the errors in the language files.
Otsikko: Re: Deleted threads to throw a 404 header
Kirjoitti: Thantos - elokuu 04, 2006, 09:23:12 IP
The problem is that SMF doesn't really have a way to know if the topic in question was deleted, hasn't been created yet, or simply off limits.  Ok the off limits it could figure out but that'd take more time.
Otsikko: Re: Deleted threads to throw a 404 header
Kirjoitti: destalk - elokuu 04, 2006, 10:21:20 IP
Lainaus käyttäjältä: RCB I.T. Solutions - elokuu 04, 2006, 09:19:37 IP
so you want the following error given if you try to access a board or topic non-existant to non-viewable to you to be customizable?

LainaaAn Error Has Occurred!
The topic or board you are looking for appears to be either missing or off limits to you. 


Hi

Thanks, But not really what I was after. I want the http header information to return a 404 'Not Found' (http://en.wikipedia.org/wiki/404_error) message if the page is no longer there. Currently a deleted page throws a 200 (OK) message, which tells search engines that the page is still present and to continue to list the url as active and relevant.
Otsikko: Re: Deleted threads to throw a 404 header
Kirjoitti: destalk - elokuu 04, 2006, 10:32:01 IP
Lainaus käyttäjältä: Thantos - elokuu 04, 2006, 09:23:12 IP
The problem is that SMF doesn't really have a way to know if the topic in question was deleted, hasn't been created yet, or simply off limits.  Ok the off limits it could figure out but that'd take more time.

Hi Thantos

How about a checkbox option for the admin when deleting the page, as to what http error code to send to user agents? Would that make it easier to implement? For example, I could imagine the options could be 404 (page not found), 403 (forbidden), or to leave it as it currently is. Perhaps there could also be an option to customise these error pages (or to divert to an already existing 404.html).

Any use?
Otsikko: Re: Deleted threads to throw a 404 header
Kirjoitti: ryanbsoftware - elokuu 05, 2006, 03:13:27 AP
Lainaus käyttäjältä: destalk - elokuu 04, 2006, 10:21:20 IP
Lainaus käyttäjältä: RCB I.T. Solutions - elokuu 04, 2006, 09:19:37 IP
so you want the following error given if you try to access a board or topic non-existant to non-viewable to you to be customizable?

LainaaAn Error Has Occurred!
The topic or board you are looking for appears to be either missing or off limits to you. 


Hi

Thanks, But not really what I was after. I want the http header information to return a 404 'Not Found' (http://en.wikipedia.org/wiki/404_error) message if the page is no longer there. Currently a deleted page throws a 200 (OK) message, which tells search engines that the page is still present and to continue to list the url as active and relevant.

oh i see, well i am no php scriper so i don't know for sure, but could SMF be written to thow a 404 header when displaying that message?
Otsikko: Re: Deleted threads to throw a 404 header
Kirjoitti: destalk - elokuu 05, 2006, 12:57:38 IP
I'm probably even less of a PHP scripter. I can barely even use HTML. ;)

However, I have used PHP content management and directory systems that have this kind facility, so I'm making an educated guess that it can be done. Whether it is difficult or not, someone else will have to say.
Otsikko: Re: Deleted threads to throw a 404 header
Kirjoitti: Thantos - elokuu 05, 2006, 01:05:47 IP
Note:  I haven't tested this out at all so it may not work.  Nor do I know if it'll have any type of negative impact.

The following *should* send a 404 header whenever the user can't see the topic, because its been delete, moved to a board they can't see, or just hasn't been created yet.

Find
Koodi (Load.php) [Valitse]

if ($user_info['is_guest'])
{
loadLanguage('Errors');
is_not_guest($txt['topic_gone']);
}
else
fatal_lang_error('topic_gone', false);

Replace with

header("HTTP/1.0 404 Not Found");
if ($user_info['is_guest'])
{
loadLanguage('Errors');
is_not_guest($txt['topic_gone']);
}
else
fatal_lang_error('topic_gone', false);
Otsikko: Re: Deleted threads to throw a 404 header
Kirjoitti: destalk - elokuu 05, 2006, 01:09:40 IP
Thanks Thantos

I'll try it on a test board and see how it goes.

BTW, if anyone else wants to test what header message their pages are throwing, this is a useful header checker; http://www.seoconsultants.com/tools/headers.asp