Search code examples
javahtmlcssspringfreemarker

Problem with paths accessing CSS with Spring and Apache FreeMarker


I'm having a problem trying to access my static CSS resources from lower directories. If I am in the main directory it detects everything but if I go to other lower directories, it adds the path from that folder and does not detect them.

Error (In that path "server" is a directory that should not appear, since css is in the main directory)

    <link rel="stylesheet" href="/css/bootstrap.min.css">
<!-- Bootstrap CSS
    ============================================ -->
<link rel="stylesheet" href="/css/font-awesome.min.css">

I tried from putting ../, ./ searching the internet but I didn't find anything.

I am using Apache FreeMarker


Solution

  • Use .. to indicate the parent directory:

    <link rel="stylesheet" href="../css/bootstrap.min.css">

    <link rel="stylesheet" href="../css/font-awesome.min.css">

    This will help you.