Glese Posted January 3, 2012 Share Posted January 3, 2012 header('Location: ' . $register_success); $register_success = 'register_success.php'; The header function above gets executed after a successful registering, and the variable is stated in the path.php file, which gets included into the header.php file, which also is included into the page, and also into the page with the register form. The register form is contained in the path model/register/register_script.php, and the file register_success.php is in the same folder. The problem I am having is that the header function does redirect to controller/register/register_success.php this used to be the previous location of that file. I am wondering is the old path saved somewhere in the cache, and this all is actually a caching problem? It does not seem to be a caching problem of the internet browser because I cleaned the cache out. What else could be the cause for this problem? If it is a caching problem, which cache could be, as in in which location? Quote Link to comment https://forums.phpfreaks.com/topic/254258-header-function-redirects-to-wrong-path/ Share on other sites More sharing options...
trq Posted January 3, 2012 Share Posted January 3, 2012 The location header expects a complete url, not a path. Quote Link to comment https://forums.phpfreaks.com/topic/254258-header-function-redirects-to-wrong-path/#findComment-1303618 Share on other sites More sharing options...
Glese Posted January 3, 2012 Author Share Posted January 3, 2012 So what would be your recommendation when working on a localhost server and then uploading the project to a public server? I do have my own system working with paths, but I think it still can be better, but I also know the possibilities are limited, and PHP does not have a specific path system. Quote Link to comment https://forums.phpfreaks.com/topic/254258-header-function-redirects-to-wrong-path/#findComment-1303626 Share on other sites More sharing options...
trq Posted January 3, 2012 Share Posted January 3, 2012 header($_SERVER['SERVER_NAME'] . '/somescript.php'); This will make your code portable between any host. Quote Link to comment https://forums.phpfreaks.com/topic/254258-header-function-redirects-to-wrong-path/#findComment-1303629 Share on other sites More sharing options...
Glese Posted January 3, 2012 Author Share Posted January 3, 2012 Thanks a lot for the suggestion. Quote Link to comment https://forums.phpfreaks.com/topic/254258-header-function-redirects-to-wrong-path/#findComment-1303643 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.