How to Solve WordPress Site URL Redirect Loop Problem
Today, I found out that one of my WordPress website has a redirect loop problem. When I try to log into WordPress dashboard, Google Chrome give me the error notice saying this webpage has a redirect loop.
The problem is that I set my site URL and WordPress Address URL beginning with https:// but I recently remove SSL/TLS from Nginx configuration thus creating a redirect loop. Because I am not gonna enable https on my site this time. So I decided to update the site URL and WordPress URL from MariaDB database using SQL statement.
First SSH into Linux Server and then log into MariaDB database.
mysql -u root -p
Enter database root password. After that, show all your databases.
show databases;
Find the database that WordPress using. And select it.
use <database_name>;
Now enter the following SQL select statement
select option_id,option_name,option_value from wp_options where option_id in (1,2);
Outputs
+-----------+-------------+-----------------------+ | option_id | option_name | option_value | +-----------+-------------+-----------------------+ | 1 | siteurl | https://xiaoguoan.com | | 2 | home | https://xiaoguoan.com | +-----------+-------------+-----------------------+ 2 rows in set (0.00 sec)
You can see that both siteurl and home (WordPress Address URL) begin with https. So change them so they begin with http. Enter the following SQL statement.
update wp_options set option_value='http://xiaoguoan.com' where option_id in (1,2);
It will update the value of siteurl and home to http://xiaoguoan.com. Now the redirect loop is gone and I can log into WordPress dashboard.