404 pages default to index page

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
hanno
Regular
Posts: 72
Joined: Fri May 20, 2005 8:04 am
Contact:

404 pages default to index page

Post by hanno » Tue Sep 13, 2016 2:27 pm

Hi,

I'm a bit puzzled by the behavior of s9y when it comes to 404 pages. It seems by default s9y has this line in the htaccess:
ErrorDocument 404 /index.php

The effect is that nonexisting pages get an error 404 code (correct), but they always show the start page. I wonder if there's any intent behind this. The obvious result is that a computer can see that it's an error, but a human can't. It doesn't seem to make any sense to me.
This seems true both for blogs I have based on s9y 1.x and 2.x and also for the s9y blog itself (blog.s9y.org).

If I comment this line I get the default 404 pages of my server, which seems more reasonable to me. Alternatively I think having an individual s9y error page that can be themed would also be reasonable.
I'm also wondering if commenting out that line has any side effects.

User avatar
yellowled
Regular
Posts: 7036
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: 404 pages default to index page

Post by yellowled » Tue Sep 13, 2016 5:12 pm

hanno wrote:The effect is that nonexisting pages get an error 404 code (correct), but they always show the start page. I wonder if there's any intent behind this.
I' not sure about the intent. Garvin will know more, but he's backlogged on the forums due to being on vacation, so it might take him a few days to respond.

I could imagine this being a “leave it up to the user” kind of deal. Some people might have custom error pages in static HTML. I think the static pages plugin offers the possibility to use a static page created with it as a 404 page. Also, themes can set custom content using templating (view = '404', see clean-blog's index.tpl for an example).

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

hanno
Regular
Posts: 72
Joined: Fri May 20, 2005 8:04 am
Contact:

Re: 404 pages default to index page

Post by hanno » Tue Sep 13, 2016 5:16 pm

Ok, this has been like this for years, so it can probably wait till Garvin comes back.

If the intent is to allow templated 404 pages it should probably still default to some kind of error message.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: 404 pages default to index page

Post by garvinhicking » Mon Sep 19, 2016 1:52 pm

Yeah, one intent is customized 404 pages, which is the suggested way to deal with if you want real error pages within s9y.

I for myself much prefer the "default content" of a page rather than an empty 404 page which ends my journey. This way, I can continue reading the blog and maybe find the content I was looking for somehow. I don't see benefit on showing a default server 404 page.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 7036
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: 404 pages default to index page

Post by yellowled » Mon Sep 19, 2016 6:14 pm

garvinhicking wrote:I for myself much prefer the "default content" of a page rather than an empty 404 page which ends my journey.
Could we emit a standard error message through $CONTENT on 404 pages, though? Without too much effort and maybe without breaking the view='404' and other 404 mechanisms? Because the way it is now, if the theme does not provide a 404 view, the “normal” user might not really notice that he's getting a 404 …

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: 404 pages default to index page

Post by garvinhicking » Tue Sep 20, 2016 10:37 am

Hey,

that's actually a good idea, yes! I just committed a patch to use the content_message for that. However it might possibly break things, I'll notify onli of my change so we can use it as a starting point.

It would need a new language variable "URL_NOT_FOUND", I would propose this content:

Code: Select all

The URL you have requested could not be found. You will see the default start page continue reading.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 7036
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: 404 pages default to index page

Post by yellowled » Tue Sep 20, 2016 10:49 am

garvinhicking wrote:

Code: Select all

The URL you have requested could not be found. You will see the default start page continue reading.
I don't really understand the second sentence. If someone is reading this text, do they get a link to the default start page? Are they being redirected automagically? (Wouldn't advise that.)

I think “Something went wrong. The requested URL could not be found.” works just fine and should be easy to translate. Also, it does not put the blame on the user (“you”). I'd suggest not adding any links or hints to navigations or search forms since we'll never know if users have those disabled or if their theme even supports them.

I mean, this is just supposed to be a simple 404 text, if people want more, they can still use a theme with a custom 404 view or a 404 static page …?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: 404 pages default to index page

Post by garvinhicking » Tue Sep 20, 2016 2:44 pm

Hi!

The blog shows the default start page plus this message on top of it. There's a "to continue reading" misspelling, missing the "to".

"Something went wrong" is too generic for me, then I'd leave it at "The requested URL could not be found. You can continue reading the content of the default start page"?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 7036
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: 404 pages default to index page

Post by yellowled » Tue Sep 20, 2016 4:07 pm

garvinhicking wrote:"Something went wrong" is too generic for me, then I'd leave it at "The requested URL could not be found. You can continue reading the content of the default start page"?
Ah, so we're technically not using {$CONTENT} but {$content_message} in content.tpl?

In that case, I'd just go with “The requested URL could not be found (404). This is the default start page.” That way, we're providing a little information (404) for “tech-savvy” users and still use a text message that is (I think) still easy to translate.

Can we have an “if-able variable” for this that works in content.tpl? Something similar to “{if $searchresult_tooShort}” etc. so the message can be customized in themes? (This is obviously semi-important at best, it will work out fine if not and we're probably overthinking 404 pages already.)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: 404 pages default to index page

Post by garvinhicking » Wed Sep 21, 2016 2:31 pm

Hi!

OK, I could use that wording, no problem. A theme can simply check on the view=404 parameter to customize output...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 7036
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: 404 pages default to index page

Post by yellowled » Wed Sep 21, 2016 7:19 pm

garvinhicking wrote:A theme can simply check on the view=404 parameter to customize output...
Ah, even better. Wasn't aware if $view was available in content.tpl.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
u1amo01
Regular
Posts: 267
Joined: Fri Sep 28, 2007 3:55 pm
Location: Kurpfalz, Germany
Contact:

Re: 404 pages default to index page

Post by u1amo01 » Thu Sep 22, 2016 9:57 am

Ahem, I use another solution. The plugin staticpage has a checkbox "Diese Seite als 404-Fehler-Seite definieren". Works for me. See http://u1amo01.de/blog/wrong_url

User avatar
yellowled
Regular
Posts: 7036
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: 404 pages default to index page

Post by yellowled » Thu Sep 22, 2016 11:10 am

u1amo01 wrote:Ahem, I use another solution.
Ahem, we're aware of that option.
yellowled wrote:I mean, this is just supposed to be a simple 404 text, if people want more, they can still use a theme with a custom 404 view or a 404 static page …?
That should still work. :)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
u1amo01
Regular
Posts: 267
Joined: Fri Sep 28, 2007 3:55 pm
Location: Kurpfalz, Germany
Contact:

Re: 404 pages default to index page

Post by u1amo01 » Thu Sep 22, 2016 1:49 pm

Uhh, looks like I should read more carefully. :oops: Sorry.

thh
Regular
Posts: 315
Joined: Thu Oct 26, 2006 2:38 pm
Location: Stuttgart, Germany
Contact:

Re: 404 pages default to index page

Post by thh » Sat Sep 24, 2016 3:48 pm

yellowled wrote:In that case, I'd just go with “The requested URL could not be found (404). This is the default start page.” That way, we're providing a little information (404) for “tech-savvy” users and still use a text message that is (I think) still easy to translate.
I like that, but would propose to phrase it "The requested page could not be found (404). ...". Don't frighten not-so-tech-savvy people with strange acronyms. :)

(Would have submitted a patch, but didn't find the text (yet).)

Post Reply