I am trying to create a copy of a prestashop 1.6 e-shop for development purposes from domain.com to dev.domain.com
The process I followed is
Your procedure is right, there is only a few factors that may cause your issue
.htaccess
for Apache)Here are a few rudimentary scripts I use to automate the cache cleanup and domain change for Prestashop 1.7.
Use a template file to generate a .sql
file to patch the database. If more convenient, you can manually run that on your database directly.
patch-domain.sql.template
:
UPDATE ps_configuration SET value='${SHOP_DOMAIN}' WHERE name='PS_SHOP_DOMAIN';
UPDATE ps_configuration SET value='${SHOP_DOMAIN}' WHERE name='PS_SHOP_DOMAIN_SSL';
UPDATE ps_shop_url SET domain='${SHOP_DOMAIN}', domain_ssl='${SHOP_DOMAIN}';
Generate the real .sql
patch file, and apply it
$ export SHOP_DOMAIN=mydomain.com
$ envsubst < patch-domain.sql.template > patch-domain.sql
$ mysql -u -p < patch-domain.sql
Remove all cache files except index.php
clear-cache.sh
:
#!/bin/bash
base_dir='./shared/prestashop/html'
# Clear class index in case any override changed
rm ${base_dir}/cache/class_index.php
declare -a cache_dirs=(
"cache/smarty/compile"
"cache/smarty/cache"
"cache/cachefs"
"img/tmp" # You might want to keep tmp images
"themes/*/cache"
"var/cache")
# Clear all cache folder, ignoring 'index.php'
for dir in "${cache_dirs[@]}"
do
echo Cleaning ${base_dir}/${dir}...
find ${base_dir}/${dir} -type f ! -name index.php -delete
done
EDIT: The updated gist is accessible here