PrestaShop, Technology, Tutorial, Ubuntu


Hopefully the title says enough but the main reason I needed to do this is because I my prestashop domain was forwarding to the wrong (old) domain automatically even though I verified the apache conf files were correct. I finally realized the cause was that I had to change the internal Prestashop settings manually to point to the new domain. Why manually? Because I had re-purposed the original domain and then taken down the site so I couldn’t use the old URL temporarily to even get my Prestashop admin URL up. Kind of a bad situation, I know, so if you find yourself in the same situation and haven’t already gotten as far as I have and still have access to your old domain, then it is easiest to just go into your Prestashop backend settings and change the URL pointing stuff there. You can see that here.

Otherwise, you may need to proceed down the long dark road in the bowels of the MySQL command line with me…

I’m on ubuntu server and I think MariaDB, but in either case, what I need to do is go into the MYSQL database where my Prestashop is installed and change these URL settings. The problem is that I’m really bad at MYSQL and so I wanted to write this tutorial for myself and others if needed, not just for this one purpose of solving this one problem, but also as a bit of a MySQL tutorial ‘for dummies’ as we go. Enough blah blah – Let’s do this:

1. Log into MySQL

I do this as root. I think you have to: mysql -u root -p

2. Show all the databases so you can choose the right one


This command will list them out.

3. Move into (select) the database of your choice

Pretend the name of your database is prestashop_db

USE prestashop_db

Now you are inside your database named prestashop_db

4. Show all the tables in your database

I like to do this first. Makes me feel comfortable that I’m in the right place:


5. Go into the table that you want to alter

In this case we want to change the domain found in the table called ps_shop_url. First, like above, I just want to see what’s in it.

SELECT * FROM ps_shop_url;

This will display the contents of the ps_shop_url table

Now, try it again for another one of the two more we need to do, but brace yourself for a bunch of stuff that will dump on your screen (it’s part of our self study here!):

SELECT * FROM ps_configuration;

Wow. Lot’s of crap dumped eh? Now you’ll see why we add the extra refining step in the command as follows:

SELECT * FROM ps_configuration where name="PS_SHOP_DOMAIN";

The extra ‘where name=’ seems to basically indicate a ‘table in a table’. So ‘PS_SHOP_DOMAIN’ is a table with a bunch of further cell data. I’m not entirely sure i’m correct here, but that’s what I’m seeing.

Try the last one now with the extra refinining:

SELECT * FROM ps_configuration where name="PS_SHOP_DOMAIN_SSL";

You can see both PS_SHOP_DOMAIN_SSL AND PS_SHOP_DOMAIN are found in the table ps_configuration with their respective cells of data.

6. Change the data of a cell in a table

Following this fine page we’re now going to update and set stuff.

This page also helped a lot for me to figure this out. Special thanks.

Now I’m going to go through them again one at a time and update the data with my new domain ‘’

The author of the link above did it all in one move with commas but I’m going to walk through each cell change one at a time for practice:

UPDATE ps_shop_url SET domain="" WHERE id_shop_url=1;

Now let’s see if anything changed:

SELECT * FROM ps_shop_url;

And by jove it did!


UPDATE ps_shop_url SET domain_ssl='' WHERE id_shop_url=1;

Let’s check that one too with same command:

SELECT * FROM ps_shop_url;

Good stuff, it worked too. So you can see the thing before the = sign is the ‘header’ of the cell we are updating. You can also see the id_shop_url has a 1 value in it for the one we are editing. So, to put what we did in laymans English it might look like this:

“In this table called ps_shop_url, we want to update things. There is an identifying row-header called ‘id_shop_url’ and we want to UPDATE the contents of the row that has ‘1’ in that cell (not the others if there are any). In that row, now that we’ve identified it with the 1, we want to SET (SAVE SOMETHING NEW) the data in the cell under ‘domain_ssl’ header.

Not so terrible if you walk slow….

Now that we’re done with ps_shop_url table, let’s do the ps_configuration table changes:

First, let’s remind ourselves of what this looks like before we change:

SELECT * FROM ps_configuration where name="PS_SHOP_DOMAIN";

You can see there is a header called ‘value’ and inside that value cell is our domain name we want to change. Just repeat what we’ve learned:

UPDATE ps_configuration SET value='' WHERE name="PS_SHOP_DOMAIN";

Check it:

SELECT * FROM ps_configuration where name="PS_SHOP_DOMAIN";


Same drill again but now in the PS_SHOP_DOMAIN_SSL table;

SELECT * FROM ps_configuration where name="PS_SHOP_DOMAIN_SSL";

UPDATE ps_configuration SET value='' WHERE name="PS_SHOP_DOMAIN_SSL";

Check it:

SELECT * FROM ps_configuration where name="PS_SHOP_DOMAIN_SSL";

And those are all the changes we should need to do. Hopefully now with these databases manually changed, I can see things stop redirecting to the old domain and go where they should.

Leaving MySQL with exit

It was successful for me so hopefully also helped you.

Tagged , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *