I have a very simple redirect in PHP that redirects to lowercase, I cannot do this in .htaccess because of my shared server limitations.
if (preg_match('/[A-Z]+/', $url)){
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".strtolower($url));
exit;
}
However there are certain cases where the .htaccess may have already redirected a url. All these cases have urlencoded chars ie. %7E.
So I need to check for any uppercase characters that aren't in the form of a urlencoded char and replace them with lowercase characters.
Worst (or perhaps best) case I don't want to attempt an already redirected header can I check to see if it's already been redirected in PHP.
Any ideas on how I could go about this please?