How to Move PrestaShop to a New Server Without Downtime

387 views

Why Server Migration Requires Planning

Moving a PrestaShop store to a new server is one of the most critical operations you can perform. A poorly planned migration can result in hours or even days of downtime, lost orders, broken images, email delivery failures, and SEO damage from search engines encountering errors on your site. With proper planning, you can reduce downtime to minutes — or even achieve a seamless transition with zero visible downtime for your customers.

This guide walks you through the entire process, from pre-migration preparation to post-migration verification.

Pre-Migration Checklist

Before touching anything, complete this checklist -

  • Verify new server requirements - Confirm the new server meets PrestaShop's PHP version, MySQL version, required PHP extensions (gd, curl, intl, mbstring, zip, etc.), and has enough disk space and RAM
  • Document current configuration - Note your current PHP version, php.ini settings, database credentials, cron jobs, email settings, and any custom server configurations
  • List all domains and subdomains - Include the main domain, any multistore domains, and subdomains used for static content or CDN origins
  • Identify custom files - Note any files outside the standard PrestaShop structure (custom PHP files, .htaccess rules, etc.)
  • Check SSL certificate - Plan for SSL installation on the new server before switching DNS

Phase 1 - Prepare the New Server

Install Required Software

Set up the new server with the same software stack as the old one, or better -

# Example for Ubuntu/Debian
sudo apt update
sudo apt install apache2 mysql-server php8.1 php8.1-mysql \
  php8.1-gd php8.1-curl php8.1-intl php8.1-mbstring \
  php8.1-zip php8.1-xml php8.1-bcmath

# Enable required Apache modules
sudo a2enmod rewrite ssl headers expires

Configure PHP Settings

Match or improve the PHP settings from your old server -

# In php.ini
memory_limit = 512M
max_execution_time = 300
max_input_time = 300
post_max_size = 64M
upload_max_filesize = 64M
max_input_vars = 10000

Create the Database

# Log into MySQL and create database
mysql -u root -p
CREATE DATABASE prestashop CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'ps_user'@'localhost' IDENTIFIED BY 'strong_password_here';
GRANT ALL PRIVILEGES ON prestashop.* TO 'ps_user'@'localhost';
FLUSH PRIVILEGES;

Install SSL Certificate

Install Let's Encrypt or your commercial SSL certificate on the new server before migration. You can use the HTTP-01 challenge with a temporary domain or the DNS-01 challenge to get a certificate without pointing your domain to the new server yet.

# Using certbot with DNS challenge
sudo certbot certonly --manual --preferred-challenges dns \
  -d yourdomain.com -d www.yourdomain.com

Phase 2 - Transfer Files

Create a Complete File Backup on the Old Server

# On the old server, create a compressed archive
cd /var/www/html
tar czf /tmp/prestashop_files_$(date +%Y%m%d).tar.gz prestashop/

Transfer Files to the New Server

Use rsync for efficient file transfer - it is faster than FTP and can resume interrupted transfers -

# Transfer files from old server to new server
rsync -avz --progress -e ssh \
  /var/www/html/prestashop/ \
  user@new-server:/var/www/html/prestashop/

Set Correct Permissions

# On the new server
find /var/www/html/prestashop -type d -exec chmod 755 {} \;
find /var/www/html/prestashop -type f -exec chmod 644 {} \;
chown -R www-data:www-data /var/www/html/prestashop

Phase 3 - Transfer the Database

Export the Database from the Old Server

# On the old server
mysqldump -u root -p --single-transaction --routines --triggers \
  prestashop > /tmp/prestashop_db_$(date +%Y%m%d).sql

Transfer and Import to the New Server

# Transfer the SQL file
scp /tmp/prestashop_db_*.sql user@new-server:/tmp/

# Import on the new server
mysql -u ps_user -p prestashop < /tmp/prestashop_db_*.sql

Phase 4 - Update Configuration

Update Database Connection Settings

Edit app/config/parameters.php on the new server -

'database_host' => '127.0.0.1',
'database_port' => '',
'database_name' => 'prestashop',
'database_user' => 'ps_user',
'database_password' => 'strong_password_here',

Do NOT Change Shop URLs Yet

Keep the shop URLs pointing to the same domain. Do not change PS_SHOP_DOMAIN or PS_SHOP_DOMAIN_SSL — the domain stays the same, only the server behind it changes.

Phase 5 - Test on the New Server

Before switching DNS, test the new server by modifying your local hosts file -

# On your computer, edit the hosts file
# Windows: C:\Windows\System32\drivers\etc\hosts
# Mac/Linux: /etc/hosts

# Add this line (use the new server's IP)
203.0.113.50  yourdomain.com  www.yourdomain.com

Now browse to your domain in a browser. You will see the site running on the new server while everyone else still sees the old server. Test thoroughly -

  • Homepage, category pages, product pages
  • Add to cart and checkout process
  • Admin panel login and navigation
  • Image loading (check for broken images)
  • Module functionality
  • Email sending (if possible)

Phase 6 - The Switchover (Minimizing Downtime)

This is the critical phase. Here is how to minimize downtime -

The Zero-Downtime Approach

  1. Lower DNS TTL in advance - At least 48 hours before migration, lower your DNS TTL to 300 seconds (5 minutes). This ensures DNS changes propagate quickly.
  2. Put the old store in maintenance mode - This prevents new orders from being placed on the old server that would be lost.
  3. Do a final database sync - Export the database again from the old server and import it on the new server to capture any orders or changes since the initial transfer.
  4. Do a final file sync - Run rsync again to catch any file changes.
  5. Switch DNS - Update your domain's A record to point to the new server's IP address.
  6. Take the new store out of maintenance mode - Your store is now live on the new server.
# Final sync commands (run during switchover window)
# 1. Put old store in maintenance mode (in old server's DB)
mysql -u root -p prestashop -e \
  "UPDATE ps_configuration SET value='1' WHERE name='PS_SHOP_ENABLE';"

# 2. Final database export from old server
mysqldump -u root -p --single-transaction prestashop > /tmp/final_sync.sql

# 3. Transfer and import to new server
scp /tmp/final_sync.sql user@new-server:/tmp/
mysql -u ps_user -p prestashop < /tmp/final_sync.sql

# 4. Final file sync
rsync -avz --delete -e ssh \
  /var/www/html/prestashop/ \
  user@new-server:/var/www/html/prestashop/

# 5. Enable store on new server
mysql -u ps_user -p prestashop -e \
  "UPDATE ps_configuration SET value='0' WHERE name='PS_SHOP_ENABLE';"

Phase 7 - Post-Migration Verification

Clear All Caches

# On the new server
rm -rf /var/www/html/prestashop/var/cache/prod/*
rm -rf /var/www/html/prestashop/var/cache/dev/*

Regenerate the .htaccess File

Log into the admin panel on the new server, go to Shop Parameters > Traffic & SEO, and click Save to regenerate the .htaccess file.

Verify SSL

Check that your SSL certificate is working correctly on the new server. Visit your store with https:// and verify the padlock icon appears.

Test Email Delivery

Send a test order or contact form submission to verify that email delivery works from the new server. Update SMTP settings if needed.

Check Cron Jobs

Recreate any cron jobs that existed on the old server (sitemap generation, module-specific crons, etc.).

Monitor for Issues

Keep both servers running for at least 48-72 hours after the switch. Monitor -

  • Server error logs for any issues
  • Google Search Console for crawl errors
  • Order processing to ensure nothing is lost
  • Email delivery from the new server

Keep the Old Server as Fallback

Do not cancel the old hosting immediately. Keep it for at least a week in case you need to switch back quickly. If problems arise, you can simply change DNS back to the old server's IP.

Common Migration Pitfalls

Hardcoded Paths in Module Files

Some modules store absolute file paths in the database or configuration files. If the installation path on the new server differs from the old one (e.g., /home/user/public_html vs /var/www/html), these modules may break. Search the database for the old path and update it.

Email Configuration

If the old server used a local SMTP server for sending emails, the new server needs the same configuration. Consider switching to an external SMTP service like Gmail, Amazon SES, or Mailgun to avoid this issue entirely.

Image URLs

Verify that all product images load correctly. PrestaShop stores image file paths relative to the installation directory, but some themes or modules may use absolute URLs. Check the page source for any URLs pointing to the old server.

Mixed Content After SSL

If the new server has a different SSL configuration, you may get mixed content warnings. Ensure all internal URLs use HTTPS by checking the store URL settings and running a mixed content scanner.

For more details, read our guides: Backup Your PrestaShop Store: Complete Data Protection Guide and Choosing Hosting for PrestaShop: What Matters and What Is Marketing.

Was this answer helpful?

Still have questions?

Can't find what you're looking for? Send us your question and we'll get back to you quickly.

Loading...
Back to top