Vishal
Vishal

Reputation: 129

how to redirect current page to other page

I want to redirect current page to other page i use this code but its not working

if($abc=="doc" || $abc=="docx" || $abc=="rtf")
        {
            header("Location: abc.php");
           }

AND

if($abc=="doc" || $abc=="docx" || $abc=="rtf")
    {
        echo "<meta http-equiv='refresh' content='0;url=abc.php'>";

    }

Upvotes: 0

Views: 125

Answers (1)

Benjamin Brizzi
Benjamin Brizzi

Reputation: 122

header() should work. However, it must be the first output of your script. If anything is sent before, it will not be taken into account. Check that the php script doesn't echo anything. Even newlines before the initial

Upvotes: 1

Related Questions