How to Fix Redirect loop on wp admin?

By | May 11, 2020

I was facing the redirection issues ” Redirect loop when trying to login to WordPress admin” after moving a site to the Nginx server.

I tried myself from every aspect as per my knowledge and applied a few googled ways also(which I will also enlist below). But unfortunately, No way worked for me.

The ways which didn’t help me to fix the redirect loop issue in WordPress are:

Method 1: Clearing Browser Cookies and Cache

Method 2: Restoring Default .htaccess file

Method 3: Deactivating Themes and Plugins

Method 4: By removing session_token values in wp_usermeta table.

Method 5: By adding update_option calls in wp-login.php.

Method 6: By adding 

define(‘WP_SITEURL’, ‘https://www.example.com’);

define(‘WP_HOME’, ‘https://www.example.com’);

in config file.

 

After a lot of research, I resolved this problem by defining security keys in the wp-config.php file.

define(‘AUTH_KEY’, ”);

define(‘SECURE_AUTH_KEY’, ”);

define(‘LOGGED_IN_KEY’, ”);

define(‘NONCE_KEY’, ”);

define(‘AUTH_SALT’, ”);

define(‘SECURE_AUTH_SALT’, ”);

define(‘LOGGED_IN_SALT’, ”);

define(‘NONCE_SALT’, ”);

For some reason, these values were empty after migrating the website to the Nginx server. Replace empty strings by automatically generated strings. You can find automatically generated unique string from here: 
https://api.wordpress.org/secret-key/1.1/salt/

Leave a Reply

Your email address will not be published. Required fields are marked *