config.php put at the root level, this file will be included in any pages.
Then at config.php
<?php
define( 'ROOT_DIR', dirname(__FILE__) );
?>
So at all other pages from different sub/a.php , sub/sub/b.php directories, when I want to include a specific file in specific location, I just need to
include( ROOT_DIR.'/include/functions.php' );
In windows server, the ROOT_DIR bring the value to C:/inetpub/vhosts/domain.com
Is this a good/secure way?
It seems like via this way, when I move the b.php to other upper level folder, I don't need to do any changes to the include file path, which is good for maintenance.
Any cons? Like SEO wise, or any other reason... What you guys think.