( also answered here, because others are all wrongs and there is no answer/solution over all internet (almost for what i have find out): https://stackoverflow.com/questions/492 ... 3#71355373 )
Code: Select all
if(!empty($_SERVER['REQUEST_URI']))
{
if(substr($_SERVER['REQUEST_URI'], -1, 1) == '/'){
$REQUEST_URI = substr($_SERVER['REQUEST_URI'], 0, -1);
}
$siteUrl = get_option('siteurl');
if(substr($siteUrl, -1, 1) == '/'){
$siteUrl = substr($siteUrl, 0, -1);
}
if(!empty($REQUEST_URI)){
$r = strpos($siteUrl, $REQUEST_URI);
if($r !== false)
{ $HOMEPAGE = true; }
} elseif ( $_SERVER['REQUEST_URI'] == '/' OR empty($REQUEST_URI) ){ $HOMEPAGE = true; }
}
var_dump($HOMEPAGE);