cant access files that have includes with relative URls

This sound like a work for __DIR__, you can check documentation here

The directory of the file. If used inside an include, the directory of the included file is returned. This is equivalent to dirname(FILE). This directory name does not have a trailing slash unless it is the root directory. (Added in PHP 5.3.0.)

Otherwise you can still switch all your relative paths to absolute path and avoid any problem if some file are included in others.

As side note i would reccomend to not use php short tag <?...?>, I'd rather use long tags <?php....?>

I believe the simplest solution would be to add the following line to your header:

<base href="">

Then all of your relative paths will start from the root directory. The alternative is to update all of your relative paths corresponding to their location in the directory hierarchy. Something like:

$_SERVER['DOCUMENT_ROOT'] . '/dir1/dir2/page.html'

// or...


From the site :

Files are included based on the file path given or, if none is given, the include_path specified. If the file isn't found in the include_path, include will finally check in the calling script's own directory and the current working directory before failing. The include construct will emit a warning if it cannot find a file; this is different behavior from require, which will emit a fatal error


In case anyone runs into this annoying issue, the ClasspathUriResolver was the culprit, prepending a "/" on relative path includes. I switched it over to use a default Uri resolver (in and it runs fine without issue on Tomcat 8.

CommonsXsdSchemaCollection collection = new CommonsXsdSchemaCollection(
collection.setUriResolver(new DefaultURIResolver());
return collection;

Set STATIC_URL when using a subdomain to serve your static files to the protocol relative url like so STATIC_URL = '//'.


Message :
Login to Add Your Comments .
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © All Rights Reserved .