Client asked me to automatically redirect any urls with a pound sign in them to a version without a pound sign, but I don't think I am detecting a # in any of my urls with this formula. I emailed myself a sample URL using the curPageURL() formula and it didn't contain the trailing # sign in the url I was testing.
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
if(stripos($currenturl,'#'))
{
Header( "HTTP/1.1 301 Moved Permanently" );
$location = 'Location: ' . str_replace('#','',$currenturl) . '/';
Header($location);
}
*Correction - I said at the end in the Title, and I mean the end, my code here apparantly detects for the pound sign anywhere in the url. *