I've been trying to reorganize my website's folder structure to make it impossible for users to reach certain directories or files via URL, and moved these folders outside the root folder based on this answer. Since I'm testing this on a local server (xampp), I changed this in my httpd file:
DocumentRoot "C:/xampp/htdocs/website"
<Directory "C:/xampp/htdocs/website">...</Directory>
and my website's folder structure now looks like this:
htdocs
css
styles.css
includes
header.php
website
index.php
Typing localhost
into my browser correctly displays index.php
, which includes my header with include '../includes/header.php';
. In header.php
I've tried linking my CSS file like this:
<link rel="stylesheet" type="text/css" href="../css/styles.css">
I thought this would simply go up a directory from includes
or website
to css
since that has worked for all of my includes, but no matter what I've tried (including other links) I cannot get my CSS to work unless I put the css
folder somewhere inside the root directory. I've also tried spamming CTRL+F5
, opening my website in every major browser and restarting Apache.
I'm sure there must be a simple explanation for this that I'm overlooking.