Static website configuration

Hi folks,

I’m using this cool plugin by d4l-data4life to generate a static version for one of my websites https://getkirby.com/plugins/d4l-data4life/static-site-generator. Here is the structure of my folder, as hosted on my client’s FTP:

πŸ“„ .htaccess
πŸ“ assets
πŸ“ content
πŸ“„ index.php
πŸ“ kirby
πŸ“ media
πŸ“ site
πŸ“ static

And here is my config.php file:

<?php
return [
  'languages' => true,
  'debug' => true,
  'home' => 'about',
  'd4l' => [
    'static_site_generator' => [
      'endpoint' => 'generate-static-site', # set to any string like 'generate-static-site' to use the built-in endpoint (necessary when using the blueprint field)
      'output_folder' => './static', # you can specify an absolute or relative path
      'preserve' => [], # preserve individual files / folders in the root level of the output folder (anything starting with "." is always preserved)
      'base_url' => '/', # if the static site is not mounted to the root folder of your domain, change accordingly here
      'skip_media' => false, # set to true to skip copying media files, e.g. when they are already on a CDN; combinable with 'preserve' => ['media']
      'skip_templates' => [] # ignore pages with given templates (home is always rendered)
    ]
  ],
]

But here is my problem: if I activate the RewriteBase /static rule in my .htaccess file, the static website works but I can’t access to the Panel anymore. And if I don’t active it, obviously I can access to the Panel but the website is no longer serving the static version of it.

So how do I need to configure the config.php, the index.php and the .htaccess files so the panel is still accessible by my client and the server still serving the /static version of the website? :thinking:

Let me know if my question is not clear enough.

It doesn’t say anything about htaccess changes in the plugin’s readme. How do you know it doesn’t serve the static site?

Also, what happens if you change 'base_url' => '/', to 'base_url' => '/static', in the config?

Thanks @VIPStephan for your answer. I changed 'base_url' => '/' to 'base_url' => '/static' as you suggested, and it makes the static version accessible via the mywebsite.com/static url.

But what I’m trying to find is a way to serve the static version directly via mywebsite.com (without the /static), and still being able to access to the back-office via mywebsite.com/panel. How can I do it?

@timotheegoguely Interested in how you manage that at the end? Did you solve it? I’m also struggling to understand where to serve the file versus where to access the panel after changing the base_url.