Redirection issue after website duplication with Magento 2
-
06-03-2021 - |
Question
I'm currently working a Magento 2 (2.1.14 exactly) mutli-store website and I have some problems for create a development website. I'm the only back-end developer in the company and had never work on Magento 2 before so I'm learning little by little how does it works.
We need to upgrade the Magento version, some plugins and add some functionnalities but I really need to have a clean development setup to work in, without the fear to break the production website.
Problem ⚠️
Current mode : developer
I followed these steps below but the dev website (dev.mywebsite.ch) still redirect me on the production server (www.mywebsite.ch).
- Create folder on server
dev.website.ch
- Create a sub-domain and point to the newly created folder
- Copy all files and folders in it with
rsync -avz source/* dest/
- Create a database dump file
dump.sql
- Clean the dump file (advice from MgtCommerce) like
sed "s/\/\*[^\/]*DEFINER.*\*\///" dump.sql > clean_dump.sql
- Import the dump file in the suitable DB
- Change the database detail in
app/etc/env.php
- Change base URL and base secure URL in
core_config_data
table in the dev database
I also executed all commands I use when I want to upload a new thing/bug fix (SSH) :
chmod 775 /home/cloudpanel/htdocs/*/ -R
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy en_US fr_FR de_DE
php bin/magento cache:flush
php bin/magento cache:clean
Questions I used...
Solution
Cache
Try running the below commands
rm -rf var/cache var/view_preprocessed var/page_cache generated/* pub/static/frontend
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
This should solve your problem
SSL
If SSL isn't enabled on your development domain, make sure to use http://
in all core_config_data
table entries (and not https://
)
OTHER TIPS
the redirect problem was due to magento cache.
try to deleted everything from var/ folder for your magento site(dev.website.ch). after that you cleared your browser's cache/cookies or try with private browser for good measure & it worked!