1

I have the following folder structure tree (folder names are written in uppercase letters):

ONLINESHOP
    |-- index.html
    |-- COMPONENTS
    |-- CONFIG
    |-- TEMPLATES
        |-- CSS
            |-- main-style.css
    |-- CONTROLLERS
    |-- MODELS
    |-- VIEWS
       ...
       |-- USER
           |-- login.html

So the root folder is OnlineShop. I am trying to reach main-style.css from login.html

This works:

<link rel="stylesheet" type="text/css" href="/OnlineShop/templates/css/main-style.css">

And this doesn't:

<link rel="stylesheet" type="text/css" href="/templates/css/main-style.css">

My question: why doesn't the later code work? Isn't / supposed to bring me to the root folder (OnlineShop)?

Machavity
  • 30,841
  • 27
  • 92
  • 100
qazerty23
  • 411
  • 2
  • 6
  • 16

1 Answers1

1

What is the web application root depends on your server configuration.

As an alternative you can use:

<link rel="stylesheet" type="text/css" href="../../templates/css/main-style.css">
luke
  • 3,531
  • 1
  • 26
  • 46
  • Oh, I'm using XAMPP Apache Server, would that mean that the root folder is htdocs (that would make sense for me then)? – qazerty23 Dec 18 '16 at 16:38
  • Please check this question then: http://stackoverflow.com/questions/18902887/how-to-configuring-a-xampp-web-server-for-diffrent-root-directory – luke Dec 18 '16 at 16:39
  • Thank you, I will keep researching in the right direction now! – qazerty23 Dec 18 '16 at 16:47