---
title: "How to Check if the Current Page Is the Homepage in Joomla with PHP - General"
description: "Below you can find a PHP snippet that will allow you to detect whether we are browsing the home page. use Joomla\CMS\Factory;  $menu = Factory::get"
url: "https://www.tassos.gr/docs/common/tutorials/homepage-detect-php"
date: "2026-11-22T14:28:29+00:00"
language: "en-GB"
---

[ Home ](https://www.tassos.gr/docs) / [ General ](https://www.tassos.gr/docs/common) / [ Joomla tutorials ](https://www.tassos.gr/docs/common/tutorials)

#  How to Check if the Current Page Is the Homepage in Joomla with PHP

Below you can find a PHP snippet that will allow you to detect whether we are browsing the home page.

 ```
use Joomla\CMS\Factory;

$menu = Factory::getApplication()->getMenu();

// Determine if the user is viewing the front page
$active  = $menu->getActive();
$default = $menu->getDefault();

$isHomePage = ($active !== null && $active->id === $default->id);

if ($isHomePage)
{
    echo 'This is the front page!';
}
```

 Last updated on Nov 20th 2026 13:11
