There is a known issue in PHP where if you have Location: in the header function, it always sends a response code of 302, even if you specify another response code. For example,
will generate a 302 Temporary redirect. The correct code to use is
I am not sure if this issue has been fixed in newer versions of PHP, but definitely something to check where you use header() to perform redirects.
header("HTTP/1.1 301 Moved Permanently");