Unable to redirect after login in using $_SERVER['HTTP_REFERER'] in php
问题 I want my user to redirected to page where user clicked login so i added following code to config file so that each and ever file has access to redirect code config.php if (isset($_SERVER['HTTP_REFERER']) && basename($_SERVER['HTTP_REFERER']) != basename($_SERVER['PHP_SELF'])) { $_SESSION['redirect_url'] = $_SERVER['HTTP_REFERER']; } So that when ever i need a redirect i can simple call like bellow header('location:' . $_SESSION['redirect_url']); exit(); and when i try above code i get error