Backing up a site with a custom public folder

[Note]Note

This is only supported on Akeeba Backup 9.8.1 or later.

Akeeba Backup will automatically detect that you are using a custom public folder when taking a backup using any of the following methods:

  • Backend backup, using the component's administrator interface from a web browser.

  • Automatic backup before updating Joomla using the administrator interface from a web browser.

  • Front-end backup ("legacy") URL.

  • The CLI command akeeba:backup:alternate, which actually uses the Front-end backup ("legacy") URL.

  • JSON API backups, i.e. those taken with third party services and software.

  • Scheduled Tasks if and only if task execution takes place using the Lazy Scheduler or Web CRON methods.

Akeeba Backup will not detect that you are using a custom public folder when taking scheduled backups from the CLI UNLESS you visit its main page (site's administrator, Components, Akeeba Backup for Joomla!) AT LEAST ONCE after enabling the custom public folder feature, changing the custom public folder, or changing the Joomla installation folder.

[Important]Important

This is a limitation in Joomla! itself. Joomla's CLI does not know where the configured public folder is. When you visit Akeeba Backup's main control panel page this path is stored in the database, namely the #__ak_common table. This allows the CLI backup methods to know what Joomla! itself does not know, thereby allowing us to back up your site correctly.

The affected backup methods are:

  • The CLI backup command akeeba:backup:take.

  • Scheduled tasks if and only if task execution takes place using a CLI CRON job.

Therefore, it is important that after you enable or change this feature you immediately go visit Akeeba Backup's main page in the backend of your site.

Another alternative for fixing this problem is to create the file cli/defines.php under the folder you have installed Joomla in (e.g. /opt/joomla/cli/defines.php) with the following contents:

<?php
define('JPATH_PUBLIC', '/var/www/html');

Where /var/www/html is the absolute filesystem path of your custom public directory. This solution is perfectly compatible with Akeeba Backup 9.8.1; this file will be automatically updated when you restore your site, as per the notes in the next two documentation sections.

Akeeba Backup handles site configurations with a custom public folder by adding the public folder as an Off-site Directory Inclusion. The included folder will have the Virtual Subdirectory name JPATH_PUBLIC and will NOT be visible in the Off-site Directories Inclusion page.

[Warning]Warning

If you put your custom public folder inside your Joomla installation folder, this will NOT take place. Moreover, the restoration will NOT give the option to relocate or undo the public folder.

For example, this happens if you put your Joomla files into /var/www/joomla and your public folder into /var/www/joomla/public_html.

Please note that this configuration makes no sense as it provides no real security (a path escape vulnerability can STILL damage your site or leak information) and it takes far more effort to make it work on your server. Therefore we strongly recommend against this kind of setup.

When restoring your site you will be given the option to relocate the public folder, or undo it, depending on how you are restoring your site.