Hello,
maybe the question was already ask but I didn’t find a topic for it.
I mixed my kirby installation with a static site that already exist before.
The Kirby installation is in a subfolder called cms.
When I link to a main page created with Kirby the url looks fine examplecom/mykirbypage.
On one page, part of Kirby child-pages are shown and liked to the relative pages with <?= $page->url() ?>.
In the generated link is alway the the cms directory name visible examplecom/cms/mykirbypage/kirbysubpage.
How can I remove the /cms/?
When I write the url manually in the address bar without the cms examplecom/mykirbypage/kirbysubpage the pages works fine too.
okay. It dosen’t work.
The routing works only from the Kirby-Base Folder and deeper but not on the parent folder.
I try to figure out another solution.
You can try to do it with a rewrite rule in your .htaccess.
What do you mean with the parent folder? Is that your static HTML page? If so, then Kirby routing can’t possibly work there, but you would just have to put the correct URLs there, i.e. without the cms part in there?
my site is in the parent-folder with an index.php file and some other pages.
Kirby is installed in a subfolder called: cms
I added the following lines to my .htaccess file:
RewriteEngine On
RewriteRule ^ cms/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) cms/$1
But when I’m trying to access a child-page of a Kirby generated parent-page I get the “cms” back in the URL.
The link to the child-pages is generated with <?= $page->url() ?>
All the parent pages generated by kirby I can access without the “cms” in the URL.
You could create a custom page method (myUrl()) that returns the desired url; downside is that you would have to replace all url() methods with this custom url. With a custom method in a Page Model you could overwrite the native URL method, but you would have to create the model for each page type.