acctman Posted August 22, 2008 Share Posted August 22, 2008 hi is there a way to code into php so a file in /loc/files/page1.php , I dont have to type out header('Location: www.site.com/loc/files/page1.php'); or header('Location: /../../page1.php'); or this method which would require me to include a file each time header('Location: $site . '/loc/files/page1.php'); I'm editing files on a test site and I will be moving them over to the live site, and don't want to have to change out all the URLs to the live site. any ideas? Link to comment https://forums.phpfreaks.com/topic/120896-solved-loading-from-webroot/ Share on other sites More sharing options...
FVxSF Posted August 22, 2008 Share Posted August 22, 2008 If /loc/files/page1.php is the web root you can simply do this: header("Location: /loc/files/page1.php"); no need to enter http:// or www.yourdomin.whatever I use this method when protecting my image and archive folders. Link to comment https://forums.phpfreaks.com/topic/120896-solved-loading-from-webroot/#findComment-623160 Share on other sites More sharing options...
akitchin Posted August 22, 2008 Share Posted August 22, 2008 If /loc/files/page1.php is the web root you can simply do this: header("Location: /loc/files/page1.php"); no need to enter http:// or www.yourdomin.whatever I use this method when protecting my image and archive folders. you're probably thinking of include() - header() sends the user to that URL directly, which in this case would be invalid. acct, sorry to say, but you'll need to use one of the methods you don't like, be they symbolic links, hard-coded site URL or included site URL. Link to comment https://forums.phpfreaks.com/topic/120896-solved-loading-from-webroot/#findComment-623177 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.