En kolay yolu mutlak Pathes / URL'ler kullanmak olacaktır.
URL'ler için, gibi uygulama kök, işaret ki, bir yerde bir sabit / değişken tanımlamak:
define('ROOT_URL', 'http://www.example.com');
veya
$root_url = 'http://www.example.com';
Ve gibi, her bağlantıyı kullanabilirsiniz:
<a href="{$root_url}/my-page.php">blah</a>
This way, always OK (and the day you install your project on another server, veya in a subdirectveyay, you only have one constant/variable to modify, and everything still wveyaks)
Fveya includes / requires, always use absolute pathes too ; one solution is to use dirname
, like this :
include dirname(__FILE__) . '/my_file.php';
include dirname(__FILE__) . '/../my-other-file.php';
__FILE__
is the current file, where you are writing this line ; dirname
gets the path (the full path) to the directveyay containing that file.
With that, you never have to wveyary about the relative paths of your files.