“Virtual” subdirectory for content pages

Hi everyone,

I think the following problem can be solved either with routing or .htaccess but that’s two topics I don’t know much about.
There’s a kirby powered site in the root directory and a kirby-independent shop in /shop.

To avoid ANY possible directory conflicts with the shop I want every subpage of the kirby-site to use /site as a subdirectory.

For example:
domain.com is the home page of the kirby-site
domain.com/contact should be accessible through
domain.com/site/contact

I know I can actually move all of my pages a real directory /site but I want to avoid that because of a cleaner page structure in the panel (I don’t want the client to have to move into site to see all the pages).

How would you guys solve that problem?
Thanks in advance!

Silly question but why don’t you keep your site at domain.com and move your shop to shop.domain.com this way there will be no conflicts?

Good question!
Of course it would be easier that way but the client wants the shop in /shop because of possible users (especially older ones) who could be confused by a subdomain.

Then another possibly stupid question: couldn’t you physically move the kirby site to the /site directory and simply do one redirect or rewrite from the root “/” to “/site” (which would then be Kirby’s home page?

In case anybody is interested in this, the .htaccess for the root directory would have to look something like this:
RewriteEngine On RewriteRule ^$ site/index.php

3 Likes

I was just going to suggest the same …

I think this is what I’m going to do.
Thank you guys, you are awesome!