You are here:Home»KB»Web Design»eCommerce»Prestashop»Move Prestashop to another server, domain or sub folder
Sunday, 06 May 2012 15:58

Move Prestashop to another server, domain or sub folder

Written by

Prestashop used to be a lot easier to move, you just moved it. Unfortunately now you need to make alterations to the database for it function correctly when you move your install. The recommend method is to log in to Prestashop's backend on your old server and make the changes so they match you new server before moving, this is not always an option because you might not have the details for the new server and this gives rise to the second situation you might be in, reconfiguring prestashop's setting after the move where you do not have access to the prestashop backoffice area because it does not work.

So basically this means there are 2 methods of making these database changes:

  1. Before the move using the Prestashop Backoffice / Admin (preferred)
  2. After the move using PHPMyadmin (can be used before and after move)

Also there are considerations about which version of prestashop you are using as this makes a difference.

but in either case if you do not empty and disable the Prestashop cache this will cause you many hours of fun

Moving Prestashop v1.6

Before continuing, if your site is a live shop you should put it in to maintenance mode

  • (Preferences --> Maintenance --> Enable Shop).

Emptying and Disabling the Prestashop Cache

Disabling the cache is an important thing to do when moving prestashop because it can store redirects amongst other things that cause prestashop to load details from the old location even if you have made changes to the location settings mentioned later. It is also wise when moving prestashoop to disable or empty yoou browser cache. Sometimes even after emptying the cache you can get redirect issues and in which case restarting the browser can help especially with .htaccess and 301 redirects.

The admin area does not get cached so when the shop is moved (as per instructions below) you should be able to login, wipe and disable the cache if you access the admin directly after making the changes required for the move.

Via Prestashop's Backoffice / Admin

While you have access to the backoffice you are able to empty and disable the cache which is by far the easiest and most preferred option.

  • Goto (Advanced Parameters --> Performance ) and configure the settings in order as shown below.

Configuring the settings below will ensure you have no caching enabled and that all pages are compiled on demand preventing issues coming from this system. Make sure you scroll all the way down and disable all the caches

There is a "Clear Cache" button at the very top right of the page. This might clear all caches in one go

SMARTY

  • Template compilation = Force compilation
  • Cache = NO
  • Click Save
  • Cache = YES
  • Click Save

your smarty cache has now been flushed

CCC (Combine, Compress and Cache)

Disabling these features is optional and are just included to help debugging if your site does not start working as it should

  • Smart cache for CSS= NO
  • Smart cache for JavaScript= NO
  • Minify HTML= NO
  • Compress inline JavaScript in HTML= NO
  • Move JavaScript to the end= NO
  • Apache optimization= NO

Caching

  • Cache = NO
  • Click Save
  • Cache = YES
  • Click Save

your Cache has now been flushed. You can leave the cache disabled while you make sure the site is running as it should but this is not mandatory.

Manually

This should only be used if you do not have access to the Prestashop admin. I dont know exactly how to manually empty the cache but the following method, although extreme will work.

  1. Delete or move all files in /cache/ folder
  2. Download a fresh copy of Prestashop with the same version number as your shop
  3. Extract all of the files and folders in the cache folder from the zip into the cache folder of your shop

You can also try configuring Prestashop as shown below for your new server and see if you can log into the backoffice, then following the instructions above,empty and disable the cache through the backoffice as this should not be suffering from any caching issues.

 

Before Moving Prestashop - Using the Backoffice

PrestaShop 1.6.x. How to move website from sub-directory to the root folder - Template Monster Help - This has a video showing you the process

After Moving Prestashop - via PHPMyadmin

It should be noted that you can use these methods before you move your prestashop install if required, maybe the server is broken and you cannot access the Backoffice

These settings might only be required for legacy applications but should be changed.

ps_configuration --> PS_SHOP_DOMAIN --> value           | change to the new domain
ps_configuration --> PS_SHOP_DOMAIN_SSL --> value       | change to the new domain

Unless using multishop you should only have 1 entry in this table, if you have more you will need to alter them accordingly. You must alter the following values:

ps_shop_url -->
domain        | change to the new domain
domain_ssl    | change to the new domain
physical_uri  | change to the physical path ( i.e. /builder/public_html/shop/ )

When i edited the physical_uri i was able to access the Backoffice.

Housekeeping after gaining access to the backoffice on the new server

After you have got access to the Backoffice you should go through the following configurations to make sure everything is working correctly.

You should now goto (Preferences / SEO & URLs ) and configure the settings in order as shown below:

  • SET SHOP URL section - check your settings are correct here, they should match what you have just set in the database. If not change them and hit save
  • SET UP URLs section
    • Disable Friendly URL
    • Disable Apache's Multiviews option (optional your server might not support this feature)
    • Disable Apache's mod_security module (optional your server might not support this feature)
    • Click save
    • Enable Friendly URL - This has now regenerated your .htaccess file to match the new location
  • ROBOTS FILE GENERATION - run this and generate your new robots.txt file for the new location
  • Wipe Cache - Just to be thorough you should wipe the cache again
  • Enable Cache - if required
  • Wipe Browser Cache - Delete old or unwanted assets
  • Restart Browser - sometimes the browser will incorrectly serve the wrong assets even though you have wiped the cache because it stores them in the session.

 

Moving Prestashop Older Versions of Prestashop

By the looks of it in v.14 the location settings are in the settings.inc.php file and therefore can be changed before or after a move, but as prestashop has got more complicated (v1.5) the location settings have been added into the database and are supposed to be changed in the backoffice before moving your site as a rule. In v1.5 you can changes these settings after a move but it is a little more tricky.

Additional Steps if changing Domain - Before or After move

These steps might be optional

  • Disable SSL - This might not always be required if SSL is already configured on the target but such enviroments like you Xampp install on your windows PC it is better to have this turned off. There are 2 ways that SSL can be configured:
    • .htaccess - You can set rules in here to enforce SSL either for the front office, back office or both i.e.
      ## SSL enforcement for Prestashop Back Office
      RewriteCond %{HTTPS} !=on
      RewriteRule ^admin6def/.* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    • Admin Options - Preferences --> General Options --> Enable SSL - This enforces HTTPS for admin and enables it where required in the front office
  • Disable Canonical Redirect - There are 2 places this can be set
    • .htaccess - If the domain that you are moving to is different you can either disable this or change the domain. The .htaccess method only handles the non-www --> www redirection or vice-versa.
    • Module - You might of installed a 3rd party extension that handles product page canonicalization to make SEO better showing the search engines which is the primary product page when there are multiple entry ppints. Extensions might also handle the non-www --> www redirection. The extensions will need disabling or reconfiguring>
    • You should also make sure the cache is emptied or turned off for the changes to be applied

Notes

  • PS 1.6.0.14  - In prestashop admin, SET SHOP URI when changed in this version the database entry below is changed
    prefix_shop_url --> physical_uri = /myaccount/public_html/
    Changing this setting on it's own does not change the shop's location.
  • If you get really stuck you can move the shop to the same directory on the new server as it was on the old server. it will obviously re-direct yiou on the home page if the caches are on, but you will be able to get in to the admin and run the cache delete option in there.
  • on older version of Prestashop the following database entry is important.
    PS_BASE_URI value="/shop/"
    SHOP_URL

Links

Read 4325 times Last modified on Thursday, 03 December 2015 15:00