How to Redirect 301 in PHP?

Hello devs,

In this header 301 redirect in php tutorial, I will show you how to use the header() function in PHP to redirect users. The header function accepts two parameters. One is where you want to redirect users and the other is the status code. So if you do not know location in php redirect, then this tutorial is for you.

You know that The HTTP 301 code means the resource has been moved permanently. Let's see the example source code of php redirect:

header(
    'Location: https://example.com/some/page',
    response_code: 301
);

 

author-image
Facebook Github
A web enthusiastic, a self-motivated full-stack software engineer from Dhaka, Bangladesh with experience in developing applications using Laravel , React and Vue js