Answer the question
In order to leave comments, you need to log in
How to setup redirect after 403 Forbidden header in php?
Hello. I wanted to do this: when trying to request a specific page, check if the user is not authorized - send a 403 code and redirect, for example, to the main one.
What do I do:
header("HTTP/1.1 403 Forbidden");
header("Location: http://" . $_SERVER['HTTP_HOST']);
exit();
Status Code:302 Found
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question