How to make home page available at URL root, without appending “/pagename” to URL?

I’ve built a portfolio site with Kirby, and in connecting it to my hosting, I am realizing that the main “home” page I made is not available at the path I need it to be and expect it to be.

When I navigate to mydomain.com, I need to see the main portfolio page, but the screen is just blank. Instead my this screen is available at mydomain.com/portfolio.
Similarly, I need its children (the portfolio’s project pages) to be available at mydomain.com/project-A (for example), but it can only be found at mydomain.com/portfolio/project-A.
(This is not a new problem, it was this same way in my localhost, but I thought I might fix it more finally when I connected to hosting, so waited until this point…)

Here is the folder structure of my content folder:

/content
	/site.txt
	/error
		/error.txt
	/portfolio
		/portfolio.txt
		/project-A
			/project-A.txt
		/project-B
			/project-B.txt

I re-downloaded the starter kit to compare its behavior, and the behavior of the example content it comes with is exactly what how I need mine to be! I cannot figure out what is different between the starter kit setup and mine: I have compared the .htaccess files and site/config/config.php files (identical; nothing modified in any) and looked for routing in the starter kit but can’t find any. (I have the latest Kirby update.) Mine has no routing, and I’d prefer to solve this without it, using whichever simpler method is happening with the starter kit.

I had originally thought it was something to do with with the structure of my content folder, but the starter kit has a similar structure (as far as I can tell), wherein the home page is directly inside the content folder… HOWEVER, when visiting the starter kit’s home page on localhost, the path is simply my localhost URL prefix without a “/home” suffix. Strangely, when I visit pages that are adjacent to this home page in the starter kit’s content file, their URLs are appended with their /pagename, e.g. “/blog”. Here is an abridged version of the starter kit’s content structure for comparison (only showing blog as example adjacent page):

/content
	/site.txt
	/2-blog
		/blog.txt
		/blog-post-a
			/blog-post-a.txt
	/error
		/error.txt
	/home
		/home.txt

For the life of me, I cannot figure out how the starter kit gets its home page to appear at the root URL without needing to be appended with “/home”.
Can anyone enlighten me?

UPDATE:
I discovered via cheatsheet that the page you want to be the main root screen either has to be named “home” or else keeps its name and specify it is the home in the config file, so now my main portfolio screen appears at mydomain.com directly.

HOWEVER, the “/home” part of the URL is still appearing when I navigate to children pages (e.g. in my content folder one would live at content/home/project-A), and would be viewed at:
mydomain.com/home/project-A, rather than what I need:
mydomain.com/project-A

I tested the starter kit’s behavior and it is the same if I add direct children to its content/home folder and navigate to them in my localhost.

What is the recommended way to change this? Thanks in advance for any and all help!!! :heart_eyes:

You can use a route to achieve this, see “Omitting the blog folder” in the docs. Basically, it’s the same thing.

Thank you, thank you, this was just what I needed! Worked perfectly :smiley:

I just found this thread helpful in 2023. Noting that I believe the page @texnixe referenced is now located here: Removing the parent page slug from the URL

1 Like