This is a simplified PHP version of my question:
I want to load http://localhost/test2.php in browser, and if it's missing #test_test, reload immediately with it http://localhost/test2.php#test_test .
<?php
// causes ERR_TOO_MANY_REDIRECTS
if (strpos(strtolower($_SERVER['REQUEST_URI']), 'test_test') === false) {
header("Location: /test2.php#test_test");
}
?>
In short, I want to check for an anchor in an URI, if it's missing, reload the page with it. I am getting ERR_TOO_MANY_REDIRECTS. Any suggestions on how to tackle this?