Shopware 6 Migration: From Staging Subdomain to Production - Avoiding Common Pitfalls
Shopware 6 Migration: From Staging Subdomain to Production - Avoiding Common Pitfalls
Migrating a Shopware 6 store from a staging environment on a subdomain to a live production domain is a common task for many merchants and developers. While the process might seem straightforward, several critical steps and potential pitfalls can lead to frustrating errors, such as the dreaded 500 Internal Server Error or an "Oops, no sales channel exists for the domain" message. This community insight, drawn from a Shopware forum discussion, sheds light on best practices and crucial troubleshooting tips for a smooth transition.
The Initial Challenge: 500 Error After Migration
The discussion begins with a user attempting to migrate their Shopware 6.7.x staging environment from subdomain.domain.de to domain.de on the same hosting provider (allinkl.com). Their process involved:
- Database backup and restore.
- File system backup and restore.
- Adjusting the
.envfile. - Crucially, manually adapting the shop URL in the database to
domain.de.
Upon attempting to access the new production domain, they encountered a 500 Internal Server Error.
Diagnosing the 500 Error and Beyond
Experts quickly pointed to the importance of server and Shopware logs for diagnosing a 500 error. Key initial checks include:
- Server & Shopware Logs: These logs are invaluable for pinpointing the exact cause of a 500 error.
- Hosting Environment Consistency: Ensure PHP, MySQL, and other hosting settings are identical between staging and production, even on the same host.
- Document Root: Verify that the
publicfolder is correctly configured as the document root for the new domain. - Cache Clearance: Manually clear the Shopware cache after migration.
.htaccessIssues: A common culprit for 500 errors can be an existing.htaccessfile, especially if it contains password protection rules from the staging environment.
The Critical Mistake: Direct Database URL Changes
A significant point of correction in the thread highlighted that step 4 (manually adapting the shop URL in the database) is incorrect and unnecessary for Shopware 6. Directly manipulating the database for the shop URL can lead to various inconsistencies and errors.
The Correct Approach for Domain Updates
Instead of direct database changes, the recommended procedure for updating the domain after migration is as follows:
- Complete the database and file system transfer.
- Adjust the
.envfile with the new database credentials and any other environment-specific settings. - Access the Shopware admin panel on the new production domain (e.g.,
domain.de/admin). If the admin panel loads correctly, it indicates that the core application is functional. - Navigate to the Sales Channel settings within the Shopware admin. Here, you can correctly update the domain associated with your sales channel to
domain.de. Shopware 6 is designed to handle domain changes through its administrative interface. - Shopware may also present a dialog to update URLs for installed apps and extensions, which should be confirmed.
- Finally, remember to update the domain information in your account.shopware.com if your Shopware license or extensions are tied to the domain.
Ignoring the Sales Channel domain configuration will lead to the "Oops, no sales channel exists for the domain" error, even if the 500 error is resolved.
Conclusion
This forum discussion underscores that while migrating Shopware 6, it's crucial to follow the recommended procedures for domain changes, primarily utilizing the administrative interface rather than direct database manipulation. Thoroughly checking server logs, ensuring consistent hosting environments, and correctly configuring sales channels are key to a successful and error-free migration from staging to production.