Hey i have a little problem, i have a site like this http://www.domain.com/sub1/sub2/what2.php inside what2.php i want to include the file located here : http://www.domain.com/what2.php How should i do it? include "../what2.php"? <- this will only work if its inside sub1 include "http://www.domain.com/what2.php"? <- what if i move the site to another domain? Thanks for your help. David.
Firstly, you could always use '../../what2.php'. Secondly, including 'http://www...' never works as you would expect. It doesn't just open the file like a normal include does, as it requests the file via HTTP (and so you end up including the parsed output). Thirdly, using the full path is the best way to go as including files in one directory that include files in another directory doesn't work as you'd expect, either. However, you can dynamically determine the full path, too, by using dirname(__FILE__). If I want to include '../what2.php', I use: include dirname(__FILE__) . '../what2.php'; instead. In your case, you probably want: include dirname(__FILE__) . '../../what2.php'; Hope that all helps.