Magento 2.1.7 将网站重定向到旧 url

Magento 2.1.7 moved website redirecting to old url

我已经在我的服务器上安装了最新的 magento 2.1.7 版本并安装了主题。我已经在文件夹中安装了 magento(http://example.com/site/) everything is working fine there. Now i have moved it to root directory (http://example.com/) as a main website, but there it is not working, it redirecting to old url with SID var. http://example.com/site/?sid=8374urh347yr7w4ry

我尝试了以下更改:

magento 是否也在任何文件中存储 base_url?这样我就可以改变了。

任何帮助将不胜感激

由于我的评论解决了您的问题,我将post作为答案。

根据 magento 从缓存文件夹中获取所有配置数据,您必须清除 magentodir/var/cache - 包括所有子文件夹 - 以确保采用新配置。

你说你已经清除了缓存,我的建议是再次检查这一点。 (也许您在进行必要的更改之前清除了缓存?)

对我来说,它不仅设置了 base_url 和 secure_base_url,还设置了 base_url_link core_config_data.

首先转到 table core_config_data 下的数据库 core_config_data 将安全和不安全 url 更改为您的新商店地址,而不是 运行 这个

php -dmemory_limit=2G bin/magento setup:upgrade && php -dmemory_limit=2G bin/magento setup:di:compile && php -dmemory_limit=2G bin/magento setup:static-content:deploy -f && php -dmemory_limit=2G bin/magento indexer:reindex && php -dmemory_limit=2G bin/magento cache:flush

尝试重新启动apache。

/etc/init.d/apache2 restart
sudo /etc/init.d/apache2 restart
sudo service apache2 restart

对于像 godaddy 这样的共享主机,请尝试切换 php 版本并清除浏览器缓存。