404 page for sub levels

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

404 page for sub levels

dennis.vis
Good day all,

I'm trying to implement a 404 page. The documentation on onehippo.org describes placing an _any_ node at the root of my sitemap. This should catch all uri's that cannot be mapped to a valid page. This does work, but only for top level uri's. On my local environment http://localhost:8080/site/afy4bdsv results in a nice 'not found' page. But http://localhost:8080/site/nieuws/afy4bdsv shows a blank space where the 'not found' message should be, as well as an error on the command line about not being able to resolve the address.  
How should I go about creating a 404 page for all uri's that cannot be matched?


Dennis Vis
Consultant | Incentro Rotterdam

Fascinatio Boulevard 562-4
Capelle aan den IJssel, The Netherlands, 2909 VA


E: [hidden email]
T: +31102020544
M: +31640801868
W: www.incentro.com
Logo Incentro

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: 404 page for sub levels

William Borg Barthet
Hi Dennis,

I assume you have some wildcard matcher under your /nieuws sitemap to render news articles. What you can do is redirect to the 404 page in the component that renders the news (or in the base component) when the content bean is null. This is how it is done in the GOGREEN demo:


public class Detail extends BaseComponent {

    public static final Logger log = LoggerFactory.getLogger(Detail.class);
    private static final int PATH_DEPTH = 4;

    @Override
    public void doBeforeRender(HstRequest request, HstResponse response) {

        super.doBeforeRender(request, response);
        HippoBean document = getContentBean(request);

        if (document == null) {
            redirectToNotFoundPage(response);
            return;
        }
        request.setAttribute("document", document);

kind regards,

William Borg Barthet






On 27 September 2012 15:43, Dennis Vis <[hidden email]> wrote:
Good day all,

I'm trying to implement a 404 page. The documentation on onehippo.org describes placing an _any_ node at the root of my sitemap. This should catch all uri's that cannot be mapped to a valid page. This does work, but only for top level uri's. On my local environment http://localhost:8080/site/afy4bdsv results in a nice 'not found' page. But http://localhost:8080/site/nieuws/afy4bdsv shows a blank space where the 'not found' message should be, as well as an error on the command line about not being able to resolve the address.  
How should I go about creating a 404 page for all uri's that cannot be matched?


Dennis Vis
Consultant | Incentro Rotterdam

Fascinatio Boulevard 562-4
Capelle aan den IJssel, The Netherlands, 2909 VA


E: [hidden email]
T: <a href="tel:%2B31102020544" value="+31102020544" target="_blank">+31102020544
M: <a href="tel:%2B31640801868" value="+31640801868" target="_blank">+31640801868
W: www.incentro.com
Logo Incentro

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: 404 page for sub levels

Wouter Danes-2
In reply to this post by dennis.vis

How does the sitemap item looks under nieuws? Is it a _default_ matcher?

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Dennis Vis
Sent: donderdag 27 september 2012 15:43
To: [hidden email]
Subject: [Hippo-cms7-user] 404 page for sub levels

 

Good day all,

 

I'm trying to implement a 404 page. The documentation on onehippo.org describes placing an _any_ node at the root of my sitemap. This should catch all uri's that cannot be mapped to a valid page. This does work, but only for top level uri's. On my local environment http://localhost:8080/site/afy4bdsv results in a nice 'not found' page. But http://localhost:8080/site/nieuws/afy4bdsv shows a blank space where the 'not found' message should be, as well as an error on the command line about not being able to resolve the address.  

How should I go about creating a 404 page for all uri's that cannot be matched?



Dennis Vis
Consultant | Incentro Rotterdam

Fascinatio Boulevard 562-4
Capelle aan den IJssel, The Netherlands, 2909 VA


E: [hidden email]
T: +31102020544
M: +31640801868
W: www.incentro.com
Logo Incentro


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: 404 page for sub levels

Laurens Leeuwis
In reply to this post by dennis.vis

What I do is set the response status to 404 in the component which retrieves the document from the CMS and let Apache serve the errorpages (also for 500, etc).

 

this makes all 404 pages similar throughout the website. localhost:8080/site/binaries/onzin would otherwise result in different errorpages for example.


Van: [hidden email] [[hidden email]] namens Dennis Vis [[hidden email]]
Verzonden: donderdag 27 september 2012 15:43
To: [hidden email]
Onderwerp: [Hippo-cms7-user] 404 page for sub levels

Good day all,

I'm trying to implement a 404 page. The documentation on onehippo.org describes placing an _any_ node at the root of my sitemap. This should catch all uri's that cannot be mapped to a valid page. This does work, but only for top level uri's. On my local environment http://localhost:8080/site/afy4bdsv results in a nice 'not found' page. But http://localhost:8080/site/nieuws/afy4bdsv shows a blank space where the 'not found' message should be, as well as an error on the command line about not being able to resolve the address.  
How should I go about creating a 404 page for all uri's that cannot be matched?


Dennis Vis
Consultant | Incentro Rotterdam

Fascinatio Boulevard 562-4
Capelle aan den IJssel, The Netherlands, 2909 VA


E: [hidden email]
T: +31102020544
M: +31640801868
W: www.incentro.com
Logo Incentro

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is
intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to
read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message
in error, please notify the sender immediately and delete all copies of this message.


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: 404 page for sub levels

Wouter Danes-2

Depends on if you want your 404 page to also include content / menus / etc..

There’s another way: create a “DocumentNotFound” exception and catch it, then redirecting to a 404 page in Hippo. J

Anyways, a _default_ matcher will always match and not throw a 404, even if the document that it should link to doesn’t exist.

It’s because the HST cannot guess what you’re going to do with the relative content path. J

It DOES work the other way around: when creating links, the HST checks which are valid links to the bean/node.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Leeuwis, Laurens
Sent: donderdag 27 september 2012 15:58
To: Hippo CMS 7 implementation list
Subject: Re: [Hippo-cms7-user] 404 page for sub levels

 

What I do is set the response status to 404 in the component which retrieves the document from the CMS and let Apache serve the errorpages (also for 500, etc).

 

this makes all 404 pages similar throughout the website. localhost:8080/site/binaries/onzin would otherwise result in different errorpages for example.


Van: [hidden email] [[hidden email]] namens Dennis Vis [[hidden email]]
Verzonden: donderdag 27 september 2012 15:43
To: [hidden email]
Onderwerp: [Hippo-cms7-user] 404 page for sub levels

Good day all,

 

I'm trying to implement a 404 page. The documentation on onehippo.org describes placing an _any_ node at the root of my sitemap. This should catch all uri's that cannot be mapped to a valid page. This does work, but only for top level uri's. On my local environment http://localhost:8080/site/afy4bdsv results in a nice 'not found' page. But http://localhost:8080/site/nieuws/afy4bdsv shows a blank space where the 'not found' message should be, as well as an error on the command line about not being able to resolve the address.  

How should I go about creating a 404 page for all uri's that cannot be matched?



Dennis Vis
Consultant | Incentro Rotterdam

Fascinatio Boulevard 562-4
Capelle aan den IJssel, The Netherlands, 2909 VA


E: [hidden email]
T: +31102020544
M: +31640801868
W: www.incentro.com

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is
intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to
read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message
in error, please notify the sender immediately and delete all copies of this message.


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: 404 page for sub levels

dennis.vis
Thank you all for the advice. I did have an _any_ node below the nieuws node. I do want to show the menu and search functionality to users, so that they can navigate to a exisiting page right from the 'not found' page. I ended up using William's suggestion and it's working great.
Again, thank you all!


Dennis Vis
Consultant | Incentro Rotterdam

Fascinatio Boulevard 562-4
Capelle aan den IJssel, The Netherlands, 2909 VA


E: [hidden email]
T: +31102020544
M: +31640801868
W: www.incentro.com
Logo Incentro


2012/9/27 Wouter Danes <[hidden email]>

Depends on if you want your 404 page to also include content / menus / etc..

There’s another way: create a “DocumentNotFound” exception and catch it, then redirecting to a 404 page in Hippo. J

Anyways, a _default_ matcher will always match and not throw a 404, even if the document that it should link to doesn’t exist.

It’s because the HST cannot guess what you’re going to do with the relative content path. J

It DOES work the other way around: when creating links, the HST checks which are valid links to the bean/node.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Leeuwis, Laurens
Sent: donderdag 27 september 2012 15:58
To: Hippo CMS 7 implementation list
Subject: Re: [Hippo-cms7-user] 404 page for sub levels

 

What I do is set the response status to 404 in the component which retrieves the document from the CMS and let Apache serve the errorpages (also for 500, etc).

 

this makes all 404 pages similar throughout the website. localhost:8080/site/binaries/onzin would otherwise result in different errorpages for example.


Van: [hidden email] [[hidden email]] namens Dennis Vis [[hidden email]]
Verzonden: donderdag 27 september 2012 15:43
To: [hidden email]
Onderwerp: [Hippo-cms7-user] 404 page for sub levels

Good day all,

 

I'm trying to implement a 404 page. The documentation on onehippo.org describes placing an _any_ node at the root of my sitemap. This should catch all uri's that cannot be mapped to a valid page. This does work, but only for top level uri's. On my local environment http://localhost:8080/site/afy4bdsv results in a nice 'not found' page. But http://localhost:8080/site/nieuws/afy4bdsv shows a blank space where the 'not found' message should be, as well as an error on the command line about not being able to resolve the address.  

How should I go about creating a 404 page for all uri's that cannot be matched?



Dennis Vis
Consultant | Incentro Rotterdam

Fascinatio Boulevard 562-4
Capelle aan den IJssel, The Netherlands, 2909 VA


E: [hidden email]
T: +31102020544
M: +31640801868
W: www.incentro.com


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html