Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-07-14 23:39:46

Manhog
Member
From: Manchester, UK
Registered: 2004-03-15
Posts: 24

How do I show a 404 when a previously live article is requested?

Hello,

Similar to this thread.

I’m about to start work on updating a g1.19 TXP site to 4.0.3.

Most of the work is replacing old PHP hacks with plugins but, despite searching the forums and reading the documentation and FAQs, I can’t find an answer to the following.

You publish a live article, it says up on your site for a while, then you decide to ‘remove’ it from the site by changing the article’s status to hidden, draft or pending.

However, when someone who’s bookmarked that article goes back to it, all they see is a blank template page.

Is there anyway to stop such a page being delivered and the user being sent a 404 page?

[Edit] Should clarify that this problem only rears its head when using the URL format domain/section/id/title. I would like to keep this format on the updated site as there’s quite a few existing articles.

Thanks,
Alan.

Last edited by Manhog (2006-07-14 23:49:14)

Offline

#2 2006-07-15 01:15:23

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: How do I show a 404 when a previously live article is requested?

I’m not sure how to do it either, and it would be useful. It also happens using /domain/section/title.


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#3 2006-07-15 11:37:04

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How do I show a 404 when a previously live article is requested?

Wouldn’t it be better to send a 410 (gone) status code?
When I remove an article, page or whatever, I add a redirect to .htaccess:

Redirect gone /section/title

You can then create an ‘error_410’ page template if you wish.

Offline

#4 2006-07-15 13:18:21

Manhog
Member
From: Manchester, UK
Registered: 2004-03-15
Posts: 24

Re: How do I show a 404 when a previously live article is requested?

Els wrote:

When I remove an article, page or whatever, I add a redirect to .htaccess:

Thanks for the reply.

I agree, 410 would be better. But the point is that some kind of error should be kicked by this.

The .htacess process would work for people who know how to edit an .htaccess file, but for regular content editors (the non-technical people who are currently adding content to the existing site) that would be a real pain.

Offline

#5 2006-07-15 14:21:18

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How do I show a 404 when a previously live article is requested?

I suppose you don’t want to remove the article alltogether, that would solve it. What if you create a special section, let’s say ‘gone’, and change the section for articles that shouldn’t be live anymore? Then you would get a 404 when the original article is requested, right?

Last edited by els (2006-07-15 14:22:13)

Offline

#6 2006-07-16 01:43:47

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: How do I show a 404 when a previously live article is requested?

This problem doesn’t exist in svn, just checked. :)

Offline

#7 2006-07-17 11:43:03

Manhog
Member
From: Manchester, UK
Registered: 2004-03-15
Posts: 24

Re: How do I show a 404 when a previously live article is requested?

Thanks for the replies.

Els – that’s a very good idea. I think I’ll give that a shot.

Mary – thanks. I think you may have convinced me to get on the SVN bus.

Last edited by Manhog (2006-07-17 11:43:21)

Offline

#8 2006-07-17 12:46:24

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: How do I show a 404 when a previously live article is requested?

I think you may have convinced me to get on the SVN bus.

Hopefully you know and considered all the disadvantages as well.

For production sites we recommend to use releases for a good reason.
If you use svn it is expected that you know how to fix all possible, related problems yourself.

Last edited by Sencer (2006-07-17 12:46:39)

Offline

#9 2006-07-17 13:49:02

Manhog
Member
From: Manchester, UK
Registered: 2004-03-15
Posts: 24

Re: How do I show a 404 when a previously live article is requested?

Sencer wrote:

If you use svn it is expected that you know how to fix all possible, related problems yourself.

Read and understood! :)

Offline

#10 2006-07-17 16:23:40

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: How do I show a 404 when a previously live article is requested?

Manhog wrote:

Read and understood! :)

I’ve been running SVN on a site for four months now, I update to the latest SVN on a daily basis. I like the new features but on several occasions there’s been problems. Since this site is for my own playing around and very few visit, I don’t care if it goes belly up on occasion.

So be forewarned, it could get weird at times.

Offline

Board footer

Powered by FluxBB