简体   繁体   中英

Fatal error instead of 404 page

I've followed the guide in the documentation on making a resource contenttype and using it for a 404 page, but instead of the page I see the following fatal error:

Class: Symfony\Component\HttpKernel\Exception\HttpException
Message: The page could not be found, and there is no 'notfound' set in 'config.yml'. Sorry about that.
Code: 0

It's strange, because notfound in config.yml is set to:

notfound: resources/not-found

Any idea what it could be? Here is the contenttype:

resources:
name: Resources
singular_name: Resource
fields:
    title:
        type: text
        class: large
        required: true
    slug:
        type: slug
        uses: title
    html:
        type: textarea
        height: 150px
default_status: published
record_template: resource.twig
searchable: false
viewless: true

And resource.twig:

{{ record.title }}

Unique alias of the 404 resource I created is /resources/not-found

Ensure the resources record is "published".

…if I had $1 for every time I had personally hit this one as a result, it'd be holiday time.

resource contenttypes are not the right tool for that. Better publish a site with the slug not-found and set it in the config.

The reason your code doesn't work: You have set viewless: true on your resource contenttype, that means there is no route for it on the frontend.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM