How to move Prestashop from localhost to domain (or vice versa)

How to move Prestashop from localhost to domain (or vice versa)

This article describes how to migrate Prestashop installation from your PC (localhost) to your domain. The reverce process is pretty much the same. On localhost I’m using XAMPP, which works well for Prestashop without setting any special parameters.

1) Copy all files from from localhost to your FTP, usually into root folder or folder like “shop”

2) Backup database from localhost

Login to phpMyadmin on localhost (https://localhost/phpmyadmin/), select your database to see all the tables. Click on export tab. You can use “Quick” method to export it as .sql file or choose “Custom” and export database as compresssed file (zipped, gzipped, bzipped). I recommend compress the database, so you can upload smaller file in next step.

3) Import database on hosting server

Again, login to phpMyAdmin, select your database (usually you have to create it in administration of hosting account). Make sure your database has setup same collation (usually utf8_general_ci). Click on Import tab, select database file that you exported in previous step and click GO.

4) Change domain name and shop path in database

– Go to ps_configuration table and change PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL from ‘localhost’ to your domain name, e.g. mydomain.com

– Go to ps_shop_url and change again ‘domain’, ‘domain_ssl’ fields to your domain name and ‘physical_uri’. If you copied files into root folder, the path will be simply ‘/’.

5) Edit /config/settings.inc.php

and change details for connection to new database (usually you have to change _DB_SERVER_, _DB_NAME_, _DB_USER_, _DB_PASSWD_).

5) Regenerate .htaccess

Go to Preferences – SEO & URL and save this screen. It will regenerate new .htaccess.

It’s also better to clear cookies and browser history.[:cs]Článek popisuje jak přesunout Prestashop z PC (localhost) na Vaši doménu. Opačný proces, přesun z domény na jinou doménu atd., jsou stejné. Na localhost používám XAMPP.

1) Zkopírujte všechny soubory z localhost na Vaše FTP, zpravidla do hlavní složky nebo např. složky “eshop” apod.

2) Zálohujte databázi z localhost

Přihlašte se do phpMyadmin na localhost (https://localhost/phpmyadmin/), vyberte příslušnou databázi, abyste viděli všechny tabulky. Klikněte na záložku “Export”. Můžete vybrat “Quick” což vyexportuje .sql soubor, nebo zvolit “Custom” a vyexportovat databázi jako zkomprimovaný soubor (zip, gzip, bzip).

3) Importujte databázi na hostingu

Přihlašte se do phpMyAdmin na hostingu, vyberte databázi (obvykle ji musíte vytvořit v administraci hostingu, ujistěte se že databáze má porovnávání utf8_general_ci). Klikněte na záložku “Import”  a nahrajte databázi zálohovanou v předchozím kroku.

4) Změňte název domény a složky Prestashopu v databázi

– v tabulce ps_configuration změňte ve sloupcích PS_SHOP_DOMAIN a PS_SHOP_DOMAIN_SSL hodnotu z ‘localhost’ na Váš název domény, například e.g. mojedomena.cz

– v tabulce ps_shop_url změňte hodnotu ve sloupcích ‘domain’ a  ‘domain_ssl’ na Váš název domény. Ve sloupci ‘physical_uri’ vyplňte cestu k instalaci Prestashopu (pro hlavní adresář na FTP serveru to bude ‘/’ ).

5) Editujte soubor /config/settings.inc.php

a změňte údaje pro připojení k databázi (obvykle změníte hodnoty _DB_SERVER_, _DB_NAME_, _DB_USER_, _DB_PASSWD_).

5) Přegenerujte .htaccess

V Nastavení – SEO & URL uložte naprázdno obrazovku. Tato akce vygeneruje nový soubor .htaccess.

Následně vymažte historii prohlížeče, včetně cookies.[:]

  • Simon

    Very useful guide for someone who knows nothing about Prestashop. I used this to move an instance from one domain to another. It’s worth adding a sixth step to your instructions however.

    If moving from one domain to another, you may also need to alter the .htaccess file. A simple find/replace of all of the old domain name with the new one will do the job. Failing to do this will cause mod rewrite to have a brain fart and it will display ‘page not found’ on all pages.

    Just thought I’d throw that in there. 🙂

  • Nice piece of post, thank u very much,
    you save me lot of time

  • Paul Guillamon

    Nice post, really clear!

    • Aechel

      Yeah it is 🙂

  • Aechel

    Good job!!!!

  • Vipul Kapoor

    I was facing problems with exporting the database because it was too big. The solution I came up with was to export structure and data separately. Both export and import happened exponentially faster. Hope that helps.

    • iscato74

      How did you do that?

      • Vipul Kapoor

        I don’t remember exactly now but in phpmyadmin, open advanced options on the export page and it’ll display many options including one to export Structure, Data or Both. Use structure option once and then export again with data option. You’ll have two separate files. Google it for detailed description. I don’t exactly remember, sorry.

        • iscato74

          good enough, thanks

      • admin

        You can also export only several tables from the database and then import them one by one. This way the imports should run ok because they will be much smaller. You only have to do more imports.

      • Jirka Zinke

        You can also export only several tables from the database (to make the sql file smaller) and then import more of such files one by one.

  • Gustav North

    Thanks a lot for useful article I had a problem with changing domain.Btw I am making my webstore and looking for some addons that contains function of limited numbers of downloads,can u recommend me smth? Last time when I was surfing the Internet I’ve found this digital sales module , what do u think about it? https://www.modulesshop.com/en/prestsashop-modules/16-virtual-digital-files-products-prestashop.html