LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache css path problems (https://www.linuxquestions.org/questions/linux-server-73/apache-css-path-problems-777502/)

Azul Rondo 12-22-2009 01:13 PM

Apache css path problems
 
Hello all,
I am teaching myself php and web programming using Apache on a Fedora home box.

The problem may be with css, but I just can't get css to follow absolute paths:

This doesn't work
PHP Code:

@import url('/var/www/html/css/index.css'

This does
PHP Code:

@import "../css/index.css"


as long as the calling file is only one sub-directory deep. I have had no success with calling files that are nested two directories down.

Any advice or suggestions would be appreciated.

Rondo

acid_kewpie 12-22-2009 02:06 PM

Well this couldn't be relevant to CSS at all, that's what's in the file, not the file itself. Certainly you'd NEVER want to use absolute paths. Horrific. I'd be looking at the Directory definitions to ensure that you're allowed to access files in that location, and of course check your error logs for issues there.

Azul Rondo 12-22-2009 06:35 PM

css path
 
Quote:

Originally Posted by acid_kewpie (Post 3801535)
Well this couldn't be relevant to CSS at all, that's what's in the file, not the file itself. Certainly you'd NEVER want to use absolute paths. Horrific. I'd be looking at the Directory definitions to ensure that you're allowed to access files in that location, and of course check your error logs for issues there.

Thanks acid_kewpie, the call I'm using actually looks like this
PHP Code:

$css = $_SERVER["DOCUMENT_ROOT"] . "css";
@import url('<?php print($css);?>/index.css');

This is what the browser sees.
PHP Code:

@import url('/var/www/html/css/index.css'); 

Just to verfy that it was the path and not the syntax that failed, I've typed in the absolute path.

If I weren't allowed access wouldn't the relative path call fail as well?


All times are GMT -5. The time now is 01:55 AM.