I am developing a PHP web app and I'm in the process of implementing a redirection functionality.
I know that redirection can be dangerous when it can be set on the client side and I use ../../
as a prefix for redirection.
Is this enough to make sure one can only redirect to internal pages? I tried it with $_POST['redirurl']
containing stuff like http://www.evil.com
and ; http://www.evil.com
but non worked.
Is this safe?
if(isset($_POST['redirurl'])){
$redir='Location: ../../'.$_POST['redirurl'];
header($redir);
}