I'm working on the 404 page for my company's site, and it has a $depth
variable that says "../site/". This works fine for any bad urls in the base directory, but anything in a subfolder is grabbing the css files from the wrong place using the $depth
variable. I tried $depth = '/site/'
and it grabbed no css files at all. My question is, how can I have PHP figure out the $depth
dynamically, specifically, the number of ../
to put in? If I can get a number or something, this is easy, but I can't seem to find a quick, easy way to do this.
Edit: Turns out, the 404.php file is only in one location, regardless of which directory the bad url is referencing. So, my real problem is probably not php-related at all. Why would a 404 page get a css file in one folder when reached from www.siteurl.com/404
but get a css file of the same name from a different folder when reached from www.siteurl.com/foo/bar
?