fivestringsurf Posted June 12, 2010 Share Posted June 12, 2010 how do i redirect up a directory (into parent dirs) when using header() function and relative paths? I have tried: header("location:../../../msg.php"); Seems logical, like it would work(as in every other case), but it doesn't. the ../../../ is ignored and php sends headers by just attaching msg.php to the current location. how does one traverse back up the tree? php5 Quote Link to comment https://forums.phpfreaks.com/topic/204608-header-redirect-up-a-directory/ Share on other sites More sharing options...
trq Posted June 12, 2010 Share Posted June 12, 2010 The header function expects a url, not a file system path. Quote Link to comment https://forums.phpfreaks.com/topic/204608-header-redirect-up-a-directory/#findComment-1071287 Share on other sites More sharing options...
fivestringsurf Posted June 12, 2010 Author Share Posted June 12, 2010 ok, thanks. I guess since i've been using relative paths since the getgo (and they work if the file is in the current directory) i just assumed i could go the other direction too. before i go write some long winded function to feel out where the files are, whether its local or live...do you have a simple way to redirect using relative paths through parent directorys? probably not, but it's always worth asking:) Quote Link to comment https://forums.phpfreaks.com/topic/204608-header-redirect-up-a-directory/#findComment-1071303 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.