PHP header redirect 301 - what are the implications?

A 301 redirect in PHP using the "header" function tells the browser that the page has permanently moved to a new location. This is useful for redirecting old URLs to new ones, or redirecting pages that have been moved to a new location. The main implications of using a 301 redirect are:

  1. The browser will update its cached version of the page to the new location, so future requests for the old URL will automatically go to the new URL.

  2. Search engines will also update their indexes to the new URL, so any search results that point to the old URL will be updated to the new URL.

  3. Users will be directed to the new URL when they request the old URL.

Watch a course Learn object oriented PHP

It's important to note that a 301 redirect will pass on link equity (ranking power) to the redirected page. This means that if the page being redirected has a high PageRank, the page it redirects to will also receive some of that PageRank.

Also, the redirect should only be used if the resource is permanently gone, otherwise use a 302 redirect which tells the browser and search engines that the move is only temporary.