Install Kirby in a sub folder

I could not find any docs around this topic and htaccess problems are not my strong suit.

Sub folder

I want to have all the Kirby files in a sub folder. I tried to move them in a folder called “cms”.

My localhost url looks like this: http://localhost/megastore/cms/

Htaccess

RewriteBase /megastore/cms

When I visit the pages i come to urls like this: http://localhost/megastore/cms/about. Everything work and I guess it’s expected by what I have in my setup.

Result

What I want is urls like this (“cms” removed):

http://localhost/megastore/about

What I tried which failed

This failed

RewriteBase /megastore

Conclusion

So… All Kirby files moved to “cms” folder should reflect in no changes on frontend and the panel.

Is it a htaccess problem or a routing problem?

Any ideas?

UPDATE

I tried to add this in config.php. The the folder structure work, but the assets does not (because they link to the wrong urls).

c::set('url','http://localhost/megastore');

What about … moving Kirby to the megastore directory? Why do you need a subfolder if the content should be accessible without it in the end? :wink:

I want to have some scripts in the root. These scripts should not be dependent on Kirby so I don’t want to build them as plugins. When having both script and Kirby in the root it will be a messy root.

Maybe I’ll just do it the other way around, put the scripts in a folder instead.

That’s sounds like a more stable solution.

Yes, I’d do it like that as well. Requests to existing PHP (and other) files are not intercepted by the Kirby .htaccess, so that shouldn’t be any problem and more robust.