0

I am building a log in system but when the user logs in i'm using the PHP header function and it doesn't work I get a 404 error saying

The requested URL /account/_paw/sos/login/$url was not found on this server.

My code is as follows...

else {
$_SESSION['usr_bnmp_core_personal_identifier'] = $login;
header('Location: $url');
exit();
}

In my config.do.php i define my url as

//DEFINED URL WITHOUT TRAILING SLASH
$url = 'https://myaccount.mysitename.com';

Any help would be greatly appreciated

3
  • 2
    It's a quote issue. Change header('Location: $url'); to header("Location: $url");. Commented Jun 19, 2014 at 15:31
  • 1
    @JohnConde Thanks, that was really simple, please add as an answer so i can give you the best answer response Commented Jun 19, 2014 at 15:35
  • 1
    I've added it as an answer with a bit of an explanation for future readers of this question. Commented Jun 19, 2014 at 15:40

1 Answer 1

2

It's a quote issue. The variable $url is not interpolated when in single quotes. Changing it to double quotes solves this problem.

Change header('Location: $url'); to header("Location: $url");.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.