samuel_lopez Posted October 22, 2015 Share Posted October 22, 2015 How to redirect webpage to another webpage when refreshed or reloaded Quote Link to comment Share on other sites More sharing options...
Barand Posted October 22, 2015 Share Posted October 22, 2015 http://www.w3.org/TR/WCAG20-TECHS/H76.html Quote Link to comment Share on other sites More sharing options...
samuel_lopez Posted October 22, 2015 Author Share Posted October 22, 2015 Hi Barand, I want only to redirect to other page if I had refreshed the page. for example,user is currently at www.google.com,then when he refeshed/reloaded the page, he will be redirected to facebook.com. In the example you provided, upon going to the page,it redirects to other page after accessing the first page.Thank you Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted October 22, 2015 Share Posted October 22, 2015 Since you are posting this question in the PHP forum, look into header location http://php.net/manual/en/function.header.php Quote Link to comment Share on other sites More sharing options...
samuel_lopez Posted October 22, 2015 Author Share Posted October 22, 2015 How can I call header("Location:index.php"); when page is manually refreshed/reloaded? Quote Link to comment Share on other sites More sharing options...
benanamen Posted October 22, 2015 Share Posted October 22, 2015 You would need to set a session counter.The example assumes you dont want them back to the first page at all after refresh. (SESSION will still be set and keep redirecting) <?php session_start(); if( isset( $_SESSION['counter'] ) ) { header('Location: http://www.example.com/'); } else { $_SESSION['counter'] = 1; } ?> Quote Link to comment 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.