How to Customize 403 exception page?

Seriously Symfony documentation is really bad or outdated…

I am trying to customize the Access Denied page.

I followed this “tutorial”

https://symfony.com/doc/current/controller/error_pages.html

It says

To override the 404 error template for HTML pages, create a new
error404.html.twig template located at
templates/bundles/TwigBundle/Exception/:

But that path doesn’t exist at all ¯_(ツ)_/¯

I keep searching and I found Exception folder on this path

vendorsymfonytwig-bundleResourcesviewsException

I don’t even know if it’s the correct folder or not.

Anyway, I created error403.html.twig inside that folder.

{% extends 'base.html.twig' %}

    {% block body %}
        <h1>403 error 123456</h1>
    {% endblock %}

Nothing is changed, the error page is still the same!

I keep reading that documentation page manny times and I don’t see anything else I should do after that?

What is the right way to Customize those error pages?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *