Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » How do I…?
  3. » Page 404

#1 2006-12-28 13:38:29

sbo
Member
Registered: 2006-06-06
Posts: 47

Page 404

Hello,

It often happens that i add or erase some documents stored in the ‘files’ folder; search engines index those documents and when they change or disappear, visitors get 404 error page.

I have Textpattern 4.0.3 with a customised CSS stylesheet (http://andreasviklund.com).

I wanted to have a clean 404 error page, with a specific style, not just an error message on a blank page.

The solution i chose consist in a HTML permanent redirection in the ‘error_default’ page (sections) to a section i called 404 with a linked article, and a specific CSS style.

This solution works perfectly fine and allow me to have a 404 error page looking like other pages of my website.

What do you think ? Is there any easier or “cleaner” solution to do that ?

Thank you,

Stephane.


Stéphane.

Offline

#2 2006-12-28 14:11:19

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Page 404

txp4.0.4 offers a customizable 404 page. the ‘cleanest’ solution is to upgrade:)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2006-12-28 15:42:14

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

Re: Page 404

He already has that colak. I think he is more interested about the redirect aspect of it.

The solution i chose consist in a HTML permanent redirection in the ‘error_default’ page (sections) to a section i called 404 with a linked article, and a specific CSS style.

If you redirect every 404 error, that means you are not sending a 404 HTTP error to the client. but a 30x response. While people usually won’t care, bots or search-engines will. ALso: There isn’t really any benefit with that appraoch, since you can put arbritrary content and styling into error_default, or better yet into “error_404”, so other errors will get a different error-page.

Offline

#4 2006-12-28 15:55:01

sbo
Member
Registered: 2006-06-06
Posts: 47

Re: Page 404

I have tried to fill the ‘default-error’ page with something close to the ‘default’ page code; but it does not work; the page comes out with no CSS style.

I do not have by default a ‘error_404’ page (?).

Correct me if i’m wrong, but to send a ’404 HTTP error’, all i have to do is to add a special code at the very begining of the script of the page; right ?

Thanks a lot for your help.

Stephane.


Stéphane.

Offline

#5 2006-12-28 16:51:42

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Page 404

sbo wrote:

Hello,
I have Textpattern 4.0.3 with a customised CSS stylesheet (http://andreasviklund.com).

colak wrote:

txp4.0.4 offers a customizable 404 page. the ‘cleanest’ solution is to upgrade:)

Sencer wrote:

He already has that colak. I think he is more interested about the redirect aspect of it.

Hi sencer
I thought he was clear regarding using 4.0.3

Last edited by colak (2006-12-28 16:52:38)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2006-12-28 17:20:06

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

Re: Page 404

  1. Make sure error_default has the tags error_status and error_message. The rest can be customized.
  2. Make a new page called error_404, and customize it however you like.

Offline

#7 2006-12-28 18:46:59

sbo
Member
Registered: 2006-06-06
Posts: 47

Re: Page 404

Can you give me more details about the tags error_status and error_message ? Sorry to ask, but i only have a limited knowledge of TXP.

If i make a ‘error_404’ page, i have the same problem; i do not manage to customize this page as i would like to.

I would like this page to act as a normal page of the website, by using a page template, a CSS style, a section and an article linked to it.
I do not know if i make myself clear (sorry for my poor english).

Thanks again.

Stephane.


Stéphane.

Offline

#8 2006-12-28 18:53:25

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

Re: Page 404

error_default and error_404 can be fully customized like other Textpattern pages, but because of all the places error_default is used, it’s best that it always have those two tags mentioned.

error_404 would only be used for 404 Not Found error messages, so you can either use the two tags mentioned, and/or customize the text on it as much as you like. If you want to use a specific article for your 404 page, rather than enter the text directly in the page template, you can do that too: article_custom

Offline

#9 2006-12-28 19:33:53

sbo
Member
Registered: 2006-06-06
Posts: 47

Re: Page 404

Can you tell me how to make the ‘error_404’ page use a specific CSS style i have created in the ‘style’ section ?

Thank you!


Stéphane.

Offline

#10 2006-12-28 19:44:33

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

Re: Page 404

You can create a section ‘error’, assign page template error_404 to it, and your default or another style sheet. On the page you can use <txp:article_custom id="..." form="..." /> to display your error message article. This worked for me, see for instance here. In my article I put something like “The requested page, http://site.com<txp:page_url />, does not exist. Blah blah…”

Offline

#11 2006-12-28 22:26:44

sbo
Member
Registered: 2006-06-06
Posts: 47

Re: Page 404

Thank you Els; unfortunately, this is exactly my problem; it does not work with my page. The page template work, but not the CSS style.


Stéphane.

Offline

#12 2006-12-28 22:33:35

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

Re: Page 404

Did you create the CSS in Presentation > Style? Then it should work. Otherwise, if you have a separate file, like yoursite.com/yourstyle.css, then you can replace the <txp:css /> tag in the head of your page template with the location of the file: http://yoursite.com/yourstyle.css.

Offline

  1. Index
  2. » How do I…?
  3. » Page 404

Board footer

Powered by FluxBB