Piwigo stores far less absolute-path information than most galleries, which is part of why migrations feel deceptively easy until thumbnails vanish and album links point at the old hostname. The application resolves most URLs at runtime from the request context, but a handful of persisted values in the database and in local configuration files still reference the old environment. A clean migration means moving the files, moving the database, pointing a few configuration keys at the new location, and then forcing Piwigo to regenerate the derivative images it caches. When any one of those steps is skipped, you end up with a gallery that loads its homepage fine but shows broken image icons, dead virtual URLs, or a login loop.
On managed shared hosting running LiteSpeed on CloudLinux, you do all of this as an unprivileged account holder. There is no shell to run Piwigo's command-line helpers and no access to server daemons, so every change happens through the File Manager, phpMyAdmin, .htaccess, .user.ini, and the Piwigo admin dashboard itself. The good news is that Piwigo was designed to survive relocation, and the whole process fits comfortably inside a cPanel Jupiter or DirectAdmin Evolution session.
What Actually Moves and What Breaks
A Piwigo install is three things: the PHP application files, the uploaded and generated images under the gallery folder, and the MySQL database. The application root contains include/config_database.inc.php, which holds your database host, name, user, and password. Under local/config/ sits database.inc.php (the same credentials) and config.inc.php, where you can override defaults. The image tree lives in three directories that matter enormously during a move: galleries/ for photos added by synchronization, upload/ for web-uploaded originals, and _data/i/ where Piwigo writes every resized derivative (thumbnails, square crops, medium sizes).
The value that breaks domain changes is $conf['gallery_url'] together with any absolute URL Piwigo has cached in the config database table. Piwigo normally computes URLs relative to the current request, so simply changing your domain in the browser usually keeps the site functional. The failures appear when the old domain was hardcoded, when the site moves from a subdirectory to the domain root (or the reverse), or when derivative images were referenced by absolute paths and the _data cache is stale. Album pages in Piwigo use rewritten virtual URLs like /index.php?/category/12-holidays or pretty permalinks such as /index/category/holidays, so the rewrite configuration must survive the move too.
Before touching anything, take a complete snapshot. In cPanel, use the File Manager to select the Piwigo directory and compress it to a .zip, then download it. Export the database from phpMyAdmin using the Export tab with the Custom method, ticking the option to add DROP TABLE statements so a re-import is clean. In DirectAdmin the flow is identical through its own File Manager and the phpMyAdmin link under MySQL Management. Keep these backups off-server until the new site is verified.
Moving Files and the Database to the New Domain
Create the destination first. If you are moving to a brand-new domain, add it in cPanel under Domains (or DirectAdmin's Domain Setup), which provisions a document root like /home/USER/newdomain.com/ or public_html for the primary domain. Upload your Piwigo .zip into that document root with File Manager and extract it in place. Confirm the directory structure landed correctly: index.php and the include/, local/, _data/, and galleries/ folders should sit at the level you intend visitors to reach.
Create a fresh database and database user on the new account. In cPanel's MySQL Databases, create the database, create a user with a strong password, and add the user to the database with ALL PRIVILEGES. DirectAdmin does this in a single Create new Database form. Note the exact database name and username, remembering that shared hosting prefixes them with your account name (for example user_piwigo and user_pwguser). Open phpMyAdmin, select the new empty database, and import the SQL dump you exported earlier.
Now reconnect the application to the new database. Edit both include/config_database.inc.php and local/config/database.inc.php in File Manager and set the credentials to match what you just created:
$conf['db_base'] = 'user_piwigo';
$conf['db_user'] = 'user_pwguser';
$conf['db_password'] = 'YourStrongPassword';
$conf['db_host'] = 'localhost';Use localhost for the host on shared hosting; that routes through the local socket. If the login screen returns a database connection error, the credentials or the user-to-database grant are wrong, not the host. Set your PHP version to match the source install under cPanel's MultiPHP Manager or DirectAdmin's PHP Selector, and confirm the gd, mysqli, and exif extensions are enabled through the PHP Selector's extensions tab, since Piwigo needs GD to regenerate images.
Fixing the Gallery URL, Rewrites, and Derivatives
With files and database in place, correct the stored URL. In phpMyAdmin, browse the config table and look for a row where param is gallery_url. If present and pointing at the old domain, edit its value to the new address, for example https://newdomain.com with no trailing slash. If you cannot log in yet, force the base URL by adding a line to local/config/config.inc.php:
$conf['gallery_url'] = 'https://newdomain.com';Piwigo's pretty URLs depend on rewrite rules. Confirm the .htaccess in the gallery root routes requests through index.php. A minimal working block looks like this and is honored by LiteSpeed exactly as Apache would:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [QSA,L]
</IfModule>If Piwigo lives in a subdirectory such as /gallery/, set RewriteBase /gallery/ instead. When the site is moving from a subdirectory to the root, review the permalink settings in the admin at Administration → Configuration → Options → General so the stored URL scheme matches the new path.
The final step repairs images. Piwigo caches every resized version in _data/i/, and those files can carry stale references after a move. Log in to the admin dashboard and go to Tools → Maintenance. Run Purge derivatives cache to clear all generated thumbnails; Piwigo regenerates them on demand from the originals. Also run Purge compiled templates and Purge sessions so no cached template writes the old domain and no half-authenticated session survives the move. If synchronized folders under galleries/ moved, run Photos → Synchronize to rescan the tree. Verify that _data, upload, and galleries are writable (permission 755 on folders, 644 on files) using File Manager's permission dialog, because a read-only _data directory produces broken thumbnails that look identical to a URL problem.
Once the new site verifies, add a permanent redirect on the old domain to preserve inbound links and search rankings, and check error_log in the gallery root for any lingering path warnings. The pattern of moving files, reconnecting the database, correcting one URL value, and purging caches applies to most PHP applications; the same discipline is covered for another script in our guide to migrating TCExam between domains and servers.