Spring error_page cannot load css

The problem is that the page is looking for the assets in /premium/css/style.css where they are obviously not present

What you’re missing is a single slash /.

Instead of:

<link rel="stylesheet" type="text/css" th:href="@{css/style.css}">

…please do:

<link rel="stylesheet" type="text/css" th:href="@{/css/style.css}">

As stated in Thymeleaf’s documentation:

Relative URLs starting with / (eg: /order/details) will be automatically prefixed by the application context name.

That way your link will be relative to application context (http://domain/) and will point to proper folder.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top