PHP:
function is_homepage()
{
}
if(is_homepage())
{
echo 'You are on the homepage';
}
else
{
echo 'You are not on the homepage';
}
Explanation:
is_homepage, should work in all these cases:
- http://www.domain.com
- https://www.domain.com
- http://domain.com
- http://domain.com/?param=value
- http://domain.com/index.php?param=value
Where it shouldn’t work:
It depends of course on how your PHP script is laid out. Though the following solution would work in most cases: