worldcomingtoanend Posted March 11, 2010 Share Posted March 11, 2010 i have tried the following and all are not working: <?php header('Location: buses/index.html'); ?> <?php header("Location: buses/index.html"); ?> <?php header('Location: /root/buses.html'); ?> [code]<?php header('Location: ../buses/index.html'); ?> but to my surprise none is working. it only works when i enter a full http url but i need to use the actual path..please help me [/code] Link to comment https://forums.phpfreaks.com/topic/194957-whyare-my-scripts-failing-to-redirect/ Share on other sites More sharing options...
trq Posted March 11, 2010 Share Posted March 11, 2010 The location header expects a complete url. Most of the time it will work without it, however it is never a good idea to rely on it. Nothing to do with php, its part of the http spec. Link to comment https://forums.phpfreaks.com/topic/194957-whyare-my-scripts-failing-to-redirect/#findComment-1024990 Share on other sites More sharing options...
worldcomingtoanend Posted March 11, 2010 Author Share Posted March 11, 2010 thank you thorpe but I used exactly this <?php header('Location: buses/index.html'); ?> on anothe rpage and it worked like a charm...but now on another page it totally fails Link to comment https://forums.phpfreaks.com/topic/194957-whyare-my-scripts-failing-to-redirect/#findComment-1024995 Share on other sites More sharing options...
trq Posted March 12, 2010 Share Posted March 12, 2010 It is most likely failing because you have content prior to calling header. Place this at the top of your script.... ini_set('display_errors', 1);error_reporting(E_ALL); Do you get any errors? Link to comment https://forums.phpfreaks.com/topic/194957-whyare-my-scripts-failing-to-redirect/#findComment-1024997 Share on other sites More sharing options...
worldcomingtoanend Posted March 12, 2010 Author Share Posted March 12, 2010 i did put your code on top of the script and i also changed the php script to this <?php header("Location: ./buses.html"); ?>and i got the following result "The site you're visiting forwards the request so that it can never be finished" Link to comment https://forums.phpfreaks.com/topic/194957-whyare-my-scripts-failing-to-redirect/#findComment-1025002 Share on other sites More sharing options...
trq Posted March 12, 2010 Share Posted March 12, 2010 Do you have any mod_rewrite rules in place. That looks to me like a re-write rule loop problem. Link to comment https://forums.phpfreaks.com/topic/194957-whyare-my-scripts-failing-to-redirect/#findComment-1025004 Share on other sites More sharing options...
worldcomingtoanend Posted March 12, 2010 Author Share Posted March 12, 2010 Do you have any mod_rewrite rules in place. That looks to me like a re-write rule loop problem. thank you thorpe, will look that in the morning am tired and gotta sleep now... thanks again and good night too... Link to comment https://forums.phpfreaks.com/topic/194957-whyare-my-scripts-failing-to-redirect/#findComment-1025006 Share on other sites More sharing options...
worldcomingtoanend Posted March 17, 2010 Author Share Posted March 17, 2010 yes thanks a million it was definitely a re-write rule loop problem Link to comment https://forums.phpfreaks.com/topic/194957-whyare-my-scripts-failing-to-redirect/#findComment-1027507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.