I've got a strange problem which i aren't able to find documentation for. I've got a page in the following location during my server.

{SITE_ROOT}/admin/myfolder/myfile.php

This file uses an include to operate a worldwide configuration file which resides around the cause of the server - it will this in accordance with itself

// {SITE_ROOT}/admin/myfolder/myfile.php
// includes {SITE_ROOT}/config.php    See below explanation after edit
include('../config.php);

This works fine UNTIL I add the next .htaccess file in to the myfolder directory

// {SITE_ROOT}/admin/myfolder/.htaccess
RewriteEngine On
RewriteRule ^([0-9A-Z]+)\.gif$ gif_generator.php?gifid=$1 [L]

The objective of this rule is not important - the truth is the page above (myfile.php) should not have this rule (it should not match the regex unless of course I am mistaken - and that i could be). Yet is appears that after this rule has been used, the include() inside myfile.php fails. It's as though the present working directory from the php file is transformed due to the RewriteEngine being enabled.

Is recorded anywhere and it is possible to method to stop this from happening?

edit - I skipped something rather important. The initial file (/admin/myfolder/myfile.php) is itself being incorporated with a file within the following location (/admin/frontcontroller.php). The include path in myfile.php is really in accordance with this file. I have transformed the above mentioned question to mirror this.

Maybe this really is helpfull for you:

dirname(__FILE__)

returns your directory the file is within. If you be aware of directory structure of the site you could utilize something similar to

dirname(dirname(__FILE__))

You may also use

DIRECTORY_SEPARATOR

to obtain the directory separator specific towards the server OS

Inside your situation this could become

include(rtrim(dirname(dirname(__FILE__)),'/\\').DIRECTORY_SEPARATOR.'config.php')