skip to Main Content

I have configured an apache server with document root to public_html folder and i want to keep my css files in the above directory as following code

<head>
  <meta charset="utf-8">
  <title>Name</title>
  <link rel="stylesheet" type="text/css" href="../css/login_page.css">
</head>

Using above code i am not getting style changes related to css but if i keep my css file in public_html folder and change it to

<link rel="stylesheet" type="text/css" href="login_page.css">

there seems no problem. I want to know how to make the first code work.

4

Answers


  1. Maybe it’s about cache? Have you tried clear cahce and reload the page?

    Login or Signup to reply.
  2. To me it seams impossible, the apache server can only send the file in your public_html.(for security reasons)
    More that the server side, your browser will request a file that it’s not in the domain.

    The only solution it’s to be in your public_html.

    Edit:
    The only files that you work with were are above are php files of config files, apache will never work with files that are above the public_html

    Login or Signup to reply.
  3. It’s not clear enough for me, but if your problem is that css file in browser doesn’t update when you edit it, the solution is to disable cache for your site
    In any browser: devtools -> network -> disable cache checkbox
    example image

    Login or Signup to reply.
  4. you cannot reference files, folders outside your public_html folder. Hence the name of the folder. It’s by design and it would be a BIG security risk if this would be possible.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search