How to properly duplicate website

I copied my website.com to staging.website.com in cpanel file manager. when I login to staging.website.com/admin my “login custom image” and “primary custom logo” is wrong, it actually points to an old image that i initially setup at the beginning. any idea what’s going on?

what is the best practice for duplicating the website and admin so that it’s a perfect clone?

@cameronl, Grav is a flat file CMS, so any way you can copy all files from one location to another is fine. Using zip, FTP, scp, etc., whatever fits best in your workflow.

When all of the site’s config settings are located inside folder /user/config/, you’re done.

However, just copying is not enough when using so called Environment configuration. This is automatically used by Admin, but can also be enabled manually.

Environment configuration allows you to use specific settings per domain. Think of dev, staging, production settings. For example, you might want to switch off asset pipelining in dev, but switch on in staging/production.

The domain related settings are kept in separate folders:

  1. /system/config/ contains all available settings with defaults.
    These should never be touched.
  2. /user/config/ contains user defined settings that override the settings found in location 1.
  3. Settings for specific domains which override settings defined in location 2. and 1.
    • /user/env/domain1/config/ for configuration settings specific for domain “domain1”
    • /user/env/domain2/config/ for configuration settings specific for domain “domain2”

Note: Grav 1.6 uses location /user/domain/config/ while Grav 1.7 uses /user/env/domain/config/.

That means, that when a site is being cloned from “old-domain” into “new-domain”, the /user/env/old-domain/ folder should be copied (or renamed) into /user/env/new-domain/, and adapted as required for the new domain.

When using Admin, saved config files will automatically be stored into a folder using the current domain’s name. Admin will not automatically copy the settings for the old-domain into the folder of the new-domain.

Getting back to your issue:
This might be caused by the Environment configuration. In the new domain, Grav will fallback to /user/config/, which might still contain your old settings.

1 Like

thank you for this helpful info. I successful renamed domain folder in /user/ to the new domain and everything looks ok. btw, I am using v1.7.42.3 and there is no env folder. Am I missing something? thanks!

@cameronl, I’m not sure if it makes any difference, but this is a note at the very top of the docs:

Up to Grav 1.6 environments were stored in user/ folder. Grav 1.7 moves environments to user/env/ to make environments easier to maintain. It is highly recommended that you move all the environments into this new location on your existing sites.

And in the 1.6 to 1.7 upgrade notes it is said:

Important: Grav 1.7 moves environments into user://env folder. The old location still works, but it is better to move environments into a single location future features may rely on it.

Moving it to /user/env/ saves you from clutter in the /user root folder.

thanks. yeah, that’s odd because I started my install with 1.7

Hey, quick question - I’m trying to achieve the same thing as OP, but my user folder doesn’t contain the /env/ or /domain.com/ folder.

Screenshot 2023-10-21 014103

What am I missing here?

@Zyklome, Nothing…

As said above:

When all of the site’s config settings are located inside folder /user/config/, you’re done.