Magento 2 Development Cache Clean-up Process
Few months ago Forge launched our first Magento 2 Website. As usual we’ve run a parallel development site for further enhancement and development.
A few days ago we had to apply some major changes, and to make matters even more challenging we had to transfer the site to a new domain.
So I thought I’d write a brief article about the Magento cache clean-up process.
Step 1 – Change Base Url
Since this is a domain transfer we need to add new domain name from the Magento backend. Login to your backend CMS and go to stores -> Web
Change the Base Urls and Base Urls (Secure) Then save the configuration
Step 2 – Change Base Url In The Database
Login to your database and run
SELECT * FROM `ero_core_config_data` WHERE `value` LIKE '%olddomain.com%'
Run the above command. You will get a list of paths that use your old domain and change the values to your new domain
If web/cookie/cookie_domain is not in the path make sure to change the configuration value to the new domain
Step 3 – Clean up using CLI
Magento 2 CLI provides some useful tools to clean up your site.
Login to your CLI using your command line tool and run
rm -rf * command for all of these folders.
pub/static and run
find . -depth -name .htaccess -prune -o -delete
You can clear
var/session if you need to clear session data for users and admin. But be carefull, this could removed all cart data for users and etc
Step 4 – Finally run content deploy
Run following command to upgrade your new changes
Finally run deploy command to deploy new content