Incorrect redirect on homepage load
题
On a fresh Magento 2 Open Source install, I accidentally named the site "foo.locale" instead of "foo.local". I've updated the database with the correct value [1] but when accessing the homepage foo.local
I am still getting redirected to foo.locale
with a parameter:
$ curl -I http://foo.local
HTTP/1.1 302 Found
Location: http://foo.locale/?SID=ltpekiq86h9nltd5rhgdeaidav
I have used mysqldump
to confirm that the string foo.locale
is not found anywhere in the database, and I've used grep
to confirm that the string is not found in any files either.
Where is the redirect happening, and how can I prevent it?
[1] Changing "foo.locale" to "foo.local" in the database:
MariaDB> update core_config_data set value='http://foo.local/' where value='http://foo.locale/';
Query OK, 1 row affected (0.07 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB> update core_config_data set value='https://foo.local/' where value='https://foo.locale/';
Query OK, 1 row affected (0.07 sec)
Rows matched: 1 Changed: 1 Warnings: 0
解决方案
Please try to clear the cache.
You can clear cache using admin:
> System > Cache Management
Also, You can use command to clear cache:
- Open the terminal and run below command:
php bin/magento c:f && php bin/magento c:c
If it helps you, please accept it as a solution.