Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

How to remove /home?

Started by Leuv 8 years ago · 3 replies · 844 views
8 years ago

By default in Grav, home page has two URLs:
domain.com
domain.com/home
In this situation, there is duplicate content (Google considers this to be a huge problem).

How can you delete /home?

8 years ago

Hi
I don't know why the /home redirect in the "site" section of the admin plugin never works but I've done my own redirect with a simple line in the htaccess file:

RewriteEngine On
RedirectMatch 301 /home/? /

4 years ago

I think You nedd in configuration setings enable - Hide home route in URLs

👍 1
4 years ago

@NataliaB, Have you tested it? The settings does not have any impact on OPs urls.

In sytem.yaml, the setting hide_in_urls: false|true will only have effect on the Urls of the children of the home page.

Eg, when having the following folders:

TXT
user/pages
├── 01.home
│   ├── 01.child
│   │   └── default.md
│   └── default.md
├── 02.typography
│   └── default.md
└── images

When using hide_in_urls: false, the url of the child page will be https://mydomain/home/child

When using hide_in_urls: true, the url of the child page will be https://mydomain/child

See code in function Page.php::route() lines 1925-1935

👍 1
last edited 11/02/22 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 80 9 hours ago
General · by pamtbaau, 14 hours ago
1 51 13 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago