The browser will remember the 301 jump.

if($url = "www.xxx.com"){
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $target_url);
}

the above code, 301 redirect has been accessed in the browser, and the browser will remember that it is permanently redirected. Will directly skip code execution. However, there is a modification to $target_url, that will not take effect without knowing the browser cache. Is there any solution?

Mar.05,2021

to access url, add a timestamp, such as http://localhost/index.php?t=.

.

index.php contains the code for you to jump

if($url = 'www.xxx.com'){
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: $target_url);
}

is actually the browsing cache of the browser. There are two solutions:
one is to add a random number that changes every time on the connection
, and the other is to disable caching. Refer to the Cache-Control of http protocol

.
Menu