Change or Move PrestaShop Site Domain Name
Recently I moved a Prestashop site from a staging server to the production
server, which also means changing the domain name from eg:
staging.example.com
to www.example.com
.
The PrestaShop site was ready for production so I really didn't want to install everything from scratch and I believed that just copying the php files and keeping the same the MySql DB was enough. Well, I was wrong!!!
Every time I was pointing my browser to www.example.com
a redirection was giving me staging.example.com
. Again... I had
to investigate and solve!
I checked DNS records, they were fine and the Apache configuration wasn't redirecting anywhere. I was pretty sure about that but I had a look just in case.
So the problem had to be inside the PrestaShop directory... first one that I
could blame was the .htaccess
file, but after a quick look there
was no sign of redirection.
Then I run a grep
command to check php source files and I
visually inspected the configuration ones. Again no joy, I couldn't find
anything that was pointing me staging.example.com
.
My last option was to look inside the MySQL DB and its 164 tables using
phpMyAdmin. I was lucky I started with the obvious one...
ps_configuration
and BANG !!!
There it was ``staging.example.com``, stored inside the MySQL Database.
Long story short... if you DO NOT CHANGE the domain name stored in your MySQL database, when you access to your new domain it will always be redirect to old domain website.
What to do to move a PrestaShop site
- Backup you MySQL DB... you never know.
- Use phpMyAdmin or any other MySQL client that you like
- Connect to the DB an look for
ps_configuration
table - Find the following records:
- PS_SHOP_DOMAIN
- PS_SHOP_DOMAIN_SSL
- Edit those record, eg change
staging.example.com
domain name towww.example.com
- Copy your php files from the staging server to the new server
- Clean your browser cache if you still seeing the old website.
Update 20/07/2015
I just received an email from R. which says that in the new versions of
PrestaShop you have also to change row in table pres_shop_url
.
Danilo