Every time that I have to move a PrestaShop site, developing or supporting XT Search for Algolia, I face the same dilemma. I follow the steps recommended in the official Best Development Practices: How can I migrate my PrestaShop store to a new server? Still, after downloading the backup, restoring the files, restoring the database and configuring app/config/parameters.php I got redirected to the original domain!

The problem is simple, you restore the site, you test the new site and ...

~$ curl -I https://demo-prestashop.localhost/

HTTP/1.1 301 Moved Permanently
Date: Wed, 01 Apr 2020 16:58:07 GMT
Server: Apache/2.4.29 (Ubuntu)
Strict-Transport-Security: max-age=31536000; includeSubDomains
Location: https://demo-prestashop.extly.com/
Content-Type: text/html; charset=iso-8859-1

The solution: replace the domain that is repeated four times in the database tables! ... and, of course, the domain is also in the .htaccess.

  • Table `dbprefix_configuration`, records PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL
  • Table `dbprefix_shop_url`, fields `domain` and `domain_ssl`

That's it! Clear the cache and no more redirections.

curl -I https://demo-prestashop.localhost/
HTTP/2 200 
date: Wed, 01 Apr 2020 17:06:32 GMT

To the moon!