cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect redirect on homepage load

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
1 REPLY 1

Re: Incorrect redirect on homepage load

Hello @zaheerali46a4e 

 

Redirection depends on secure/unsecure urls in table "core_config_data".

 

You need to fetch secure urls by below query:

SELECT * FROM `core_config_data` WHERE `path` LIKE '%secure%'

This query show you all urls which help to redirect. Update them by using "config_id" and flush cache by below command:

bin/magento cache:flush

It may help you!
Thank you

Problem solved? Click Accept as Solution!