Setting the homepage

Hi there,

I keep discovering Kirby and it’s awesome ! Great job !

I’m working on localhost using MAMP. The root URL (http://localhost:8888/ymf/) doesn’t work. I need to write directly the URL to the home page (http://localhost:8888/ymf/accueil). How can I set the root URL to be linked with the homepage ?

By the way, to put my website online, eg on OVH, will I only need to copy-paste my folder to the server ?

Thx a lot !
cheers

So the complete Kirby 3 project is located in a folder calle /ymf, right?

Have you set the home page to accueil or why do you need to open that folder when visiting the website?

Does the .htaccess file exist?

Yes, that’s usually all you have to do, unless the hosting server needs some fiddling with the .htaccess file.

Yes the complete Kirby 3 project is located in a folder called /ymf.

No I didn’t set the home page to accueil. I don’t know how to do it.

I started from the plainkit-master and I didn’t add any .htaccess file so if it doesn’t exist in the plainkit-master I think I don’t have any in that project. But I don’t know where to search it.

But the plainkit comes with a .htaccess file on board. Maybe you don’t see it because files starting with a dot are usually not visible in the filesystem? You can toggle there visibility with CMD + Shift + .

Ok I see it. Thx a lot !

What’s next ?

Still not working properly? With MAMP on a Mac, I never had to change any settings to make Kirby work.

I found and opened the htaccess but didn’t change anything in it. Is there anything to write in the htaccess ?

In most cases, you can leave it untouched. In some environments it might be necessary to set the RewriteBase, but as I said, I never had to make any changes to .htaccess in a MAMP environment.

But if Kirby doesn’t work in your setting, then we have to dig deeper. What PHP version is used in your MAMP enviroment?

Kirby works perfectly. I didn’t expressed myself very clearly. That’s only a problem of URL. I would like the main URL (http://localhost:8888/ymf/) to bring directly to http://localhost:8888/ymf/accueil. In other words, I would like ‘accueil’ to be the home page but I don’t know how to set de default home page.

Assuming that accueil is a folder in /content next to the /home folder, you can set this as your home folder instead in the config file:

In /site/config/config.php:

return [
  'home' => 'accueil'
];

If there is already a return array in your config, make sure to add the new setting to the existing settings (i.e. do not add multiple return arrays).

I haven’t got any home folder.

:scream:

The home folder is required (I guess you deleted it), unless you set home to another folder like explained above.

Ok so that must be the problem ! Thx :slight_smile:

Where can I find the config.php file ?

The plainkit doesn’t come with a config file, you have to create it site/config/config.php(the config folder as well).

I created it and wrote the code but it doesn’t work

Did you put a php tag at the beginning of the file, so that it now looks like this (I added another important line):

<?php

return [
  'home' => 'accueil',
  'debug' => true // lets enable debug as well, you will need it ;)
];

I’m definately a noob :sweat:

It works, thx a lot for your help !

Have a good evening

We’ll get you there :slightly_smiling_face:!

Lesson learned: Always start your PHP code with a php tag.

I won’t forget.

cheers