# About site()-\>homePage() uri

**URL:** <https://forum.getkirby.com/t/about-site-homepage-uri/2826>\
**Category:** Questions\
**Tags:** v2\
**Created:** [December 15, 2015, 9:25am UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826 "2015-12-15T09:25:38Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [December 15, 2015, 9:25am UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/1 "2015-12-15T09:25:38Z")

</div>

When I use this:

```php
echo site()->homePage()->url() . "\n";
echo site()->homePage()->uri() . "\n";
echo site()->homePage()->slug() . "\n";

```

It prints this:

```auto
http://localhost/kirby2.2
home
home

```

The first one, url() is correct. My home page is in the root of the site and has no slug. What about the other two? I expected that at least one of them printed “”, an empty result.

So there is no way to print the uri of that page that reflect the site?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 15, 2015, 9:53am UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/2 "2015-12-15T09:53:00Z")

</div>

Well, the first one is correct because the `home` folder is routed to the site url; but you can just as well call the homepage with `http://yourdomain.com/home`. So “home” as uri and slug are correct as well.

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [December 15, 2015, 10:00am UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/3 "2015-12-15T10:00:56Z")

</div>

Ahh, I see. Then it’s not a bug.

However, do we like this behaviour? Then every Kirby installation will have possible duplicate content (not optimal for SEO).

What are the benefints of that [http://localhost/kirby2.2/home](http://localhost/kirby2.2/home) works as well?

---

<div class="post-metadata">

**Author:** ![jevets](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jevets/32/978_2.png) [@jevets](https://forum.getkirby.com/u/jevets)\
**Post date:** [December 15, 2015, 11:54am UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/4 "2015-12-15T11:54:03Z")

</div>

No benefits, I don’t think. But this is a common behavior across other CMSs. Drupal comes to mind.

You can combat the potential SEO hit by using a canonical `<link>` tag in the `<head>` for the “official” URL of the page. SEs will respect that and not punish for duplicate content.

```auto
<link rel="canonical" href="<?= $page->url() ?>">

```

EDIT: Also, if you never link to `/home`, then SEs won’t find it. Make sure your RSS feeds use `url()`; they should be spitting out full URLs anyway.

[https://support.google.com/webmasters/answer/139066?hl=en](https://support.google.com/webmasters/answer/139066?hl=en)

> **[Canonical link element](https://en.wikipedia.org/wiki/Canonical_link_element)**
>
> A canonical link element is an HTML element that helps webmasters prevent duplicate content issues by specifying the "canonical" or "preferred" version of a web page as part of search engine optimization. It is described in RFC 6596, which went live in April 2012. A major problem for search engines is to determine the original source for documents that are available on multiple URLs. Content duplication can happen in a lot of ways. The most common reasons for duplication are:

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [December 15, 2015, 12:12pm UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/5 "2015-12-15T12:12:02Z")

</div>

Yes. I know about canonicals and redirects. The best solution might be to re-route it to 404 and set 404 as status code.

I would prefer if it worked that way out of the box. Maybe add an issue to the repository? Anyone seeing any benefits of keeping it the way it is now?

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [December 15, 2015, 1:30pm UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/6 "2015-12-15T13:30:39Z")

</div>

Generally I agree that it isn’t often needed and does not make that sense.

But there’s one case where it does: If you change the homepage to something else, then the old URL of the new homepage won’t keep working. That’s why it’s useful to keep the route for the homepage.  
But maybe it could redirect using HTTP 307, so that could be a new feature.

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [December 15, 2015, 2:12pm UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/7 "2015-12-15T14:12:22Z")

</div>

That’s a rare case I think. I would prefer to add a redirect 301 myself in those rare cases. We change the page location from a page location to a home page location. For me it’s similiar to change the slug. When we change the slug the old page route is not still there. I think it should be the same for the home page (alternative) url.

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [December 15, 2015, 2:39pm UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/8 "2015-12-15T14:39:52Z")

</div>

**I added an issue:**

> <https://github.com/getkirby/kirby/issues/344>

Let’s see what Bastian thinks about it. Maybe it’s just closed but then I at least tried.

---

<div class="post-metadata">

**Author:** ![diondiondion](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/diondiondion/32/16754_2.png) [@diondiondion](https://forum.getkirby.com/u/diondiondion)\
**Post date:** [December 15, 2015, 2:48pm UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/9 "2015-12-15T14:48:40Z")

</div>

Maybe it’s just me but I really wouldn’t expect [http://localhost/kirby/home](http://localhost/kirby/home) to 404. It might be beneficial from an SEO perspective, but certainly not expected or consistent with how Kirby generally works. The easiest SEO fix is to simply not add links to `/home` in the first place, or am I missing something? I wouldn’t change anything here.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [December 15, 2015, 4:19pm UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/10 "2015-12-15T16:19:30Z")

</div>

> [@diondiondion](#):
>
> Maybe it’s just me but I really wouldn’t expect [http://localhost/kirby/home](http://localhost/kirby/home) to 404. It might be beneficial from an SEO perspective, but certainly not expected or consistent with how Kirby generally works. The easiest SEO fix is to simply not add links to /home in the first place, or am I missing something? I wouldn’t change anything here.

+1

> [@jenstornell](#):
>
> Anyone seeing any benefits of keeping it the way it is now?

I don’t know about the benefits of the current way. But I can see quite a few problems with the proposed new way. And in general with the more complexity it adds to understand Kirby in the first place.

---

<div class="post-metadata">

**Author:** ![jevets](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jevets/32/978_2.png) [@jevets](https://forum.getkirby.com/u/jevets)\
**Post date:** [December 15, 2015, 4:37pm UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/11 "2015-12-15T16:37:49Z")

</div>

I agree with @diondiondion and @distantnative

I don’t see much of a point of redirecting or throwing a 404 automatically. In most cases, nobody will ever visit the `/home` URI, including SEs.

And if one is very concerned with it, then a canonical link takes care of it, or it’s easy enough to set up a redirect back to `/`.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:03pm UTC](https://forum.getkirby.com/t/about-site-homepage-uri/2826/12 "2025-02-06T17:03:58Z")

</div>


