title: Spring Boot, Thymeleaf and CSS
body: <p>This is really silly but I am not able to get it working.</p>
  
  <p>In my spring boot mvc app, I have let's say 5 thyme leaf templates one of which is error.html.</p>
  
  <p>error.html comes handy when a request is made for any invalid routes.</p>
  
  <p>The issue happens when the invalid routes are nested (like 2 or more level) then the css dont apply.</p>
  
  <p>Eg: </p>
  
  <pre><code>http://localhost:3000/application/index- valid route and css is applied
  http://localhost:3000/application/success- valid route and css is applied
  http://localhost:3000/application/failure- valid route and css is applied
  http://localhost:3000/application/invalidroute- route does not exist but css is applied
  http://localhost:3000/application/invalidroute/something - route does not exist and css is also not applied
  </code></pre>
  
  <p>My CSS is located in css folder under the static folder</p>
  
  <p>All the thymeleaf templates are at the same level and access the css by</p>
  
  <pre><code> &lt;link rel="stylesheet" href="css/main.css"/&gt;
  </code></pre>
  
  <p>Error seen in console</p>
  
  <pre><code>GET http://localhost:3000/application/invalidroute/css/main.css net::ERR_ABORTED 404
  </code></pre>