Is your WordPress login page keeps refreshing and redirecting it back to the login screen? You undoubtedly must be eager to find the cause behind the error, as you are currently locked out of your WordPress admin because of this error.
It is always frustrating to face login issues in WordPress. In this article, we are going to solve one such login issue i.e. WordPress login page refreshing and redirecting issue.
Having said this, we would recommend you manually create a WordPress database backup before moving ahead with the solutions mentioned in this article.
Causes of the Login Page Refresh and Redirect Issue in WordPress:
There could be two main causes behind this kind of error.
- The values for the site URL and home URL fields in the WordPress options table are incorrect.
- The permalink settings or redirects setup in the .htaccess file are poorly configured.
We are going to start with the most common cause of the Login page Refresh and Redirect Issue in WordPress, i.e., incorrect WordPress URL settings and failure to set login cookies. To understand in simple words, we would look into a general way in which WordPress sets a login cookie in your browser.
- You log in.
- WordPress validates the username and password.
- A login cookie is set in your browser.
- You are redirected to the WordPress admin area.
Now, if you are redirected back to the login page, then this means that it could be either of the two scenarios.
- WordPress failed to set the login cookie correctly.
- WordPress admin area URL is incorrect.
We have discussed some of the important and common pages behind the refreshing and redirecting issue and now we rea all set to solve the issue. Let’s fix the issue together. Continue reading the article for the best solutions to fix the WordPress login page redirect and refresh issue.
Clear Cookies to Resolve Login Issues:
WordPress uses cookies for login authentication, so the first step in troubleshooting WordPress login issues is the simplest one. Clearing the browser cookies and cache is an easy job to do and it is not so complicated to move ahead with this step. So, let’s start from here only. You can follow the below steps to clear cookies to resolve your login issues.
- Go to Google Chrome.
- Open the browser settings menu.
- Go to More Tools » Clear Browsing Data.
- The Chrome Settings page will then be launched.
- A popup will appear displaying the text Clear Browsing Data on the screen.
- Select the Clear Cookies and other site data.
- Select the Cached images and files options.
- Click on the Clear data button.
- The browser cache will then be cleared by Google Chrome.
- Enable the cookies in your browser, if it is disabled.
- Restart the browser.
- Log in to your WordPress admin.
The problem should be solved by now. If not, you can continue reading the article to troubleshoot more.
Update WordPress URL Settings:
The next solution that we do suggest is to update your WordPress URL settings. But before moving ahead with that, let’s just understand when we need to go with this step.
- There is a settings option in WordPress.
- It has the URL of your website.
- It also has the URL of your WordPress installation.
- This option can be found under the Settings » General page, only if you are not locked out of your WordPress admin.
If you are getting redirected back to the login page, one of the popular reasons is that the URL is incorrect. To make sure that you do not get redirected back to your login page again because of this reason, we will try to solve the problem. For this, we are going to edit the wp-config.php file (It is a special file containing important WordPress settings) through a stepwise process.
- Use an FTP client or the File Manager app in your WordPress hosting account dashboard to edit your wp-config.php file.
- The wp-config.php file can be located in the root folder of your WordPress website.
- Go to the wp-config.php file.
- Go to the line that says ‘That’s all, stop editing! Happy publishing’, and paste the below code just before that line.
define('WP_HOME','https://www.example.com'); define('WP_SITEURL','https://www.example.com');
- In the above code, your domain name will come at the place of example.com.
- Save the changes.
- Upload the file back to the website.
Now you are all set to log in again. The error should be solved by now. If not, keep reading the article.
Delete .htaccess File in WordPress:
One of the important reasons for the refresh or redirecting of the login page is the poor configuration of corruption of the permalink settings or redirects setup in the .htaccess file. To solve this issue, we will take some steps in this direction.
- Use an FTP client or the File Manager app in your hosting account dashboard to access your website.
- The .htaccess file can be located in the root folder of your WordPress website.
- Download the .htaccess file on your device. Thus, create a backup.
- Now, delete the .htaccess file from your WordPress website.
- Open the wp-admin directory.
- Look for the .htaccess file.
- Delete it if you find it.
- Log in again to your WordPress website.
The error might get solved by now. If it is so, then you can be now sure that whatever the problem is, it is because of the .htaccess file. You need to take some extra steps here.
- Log in to your WordPress website.
- Go to the WordPress admin area.
- Visit the Settings » Permalinks page.
- Do not make any changes, but click on the Save button.
- A new .htaccess file will thus be generated.
You might have to look for some other popular cases for these types of errors if none of the above three steps can fix the issue of refreshing or redirecting to the login page for you. Having said this, let us move ahead now.
Deactivate All WordPress Plugins:
One or more of your plugins may be causing the error of refreshing or redirecting to the login page in your WordPress website. You can be more sure if the problem arose after you have installed or updated a plugin recently. However, even if this is not the case, we still need to make sure that it is not one or more of the plugins that are at fault. It is also possible that there is a conflict between any two plugins. Let us now try to fix the issue by deactivating all your WordPress plugins.
- Use an FTP client or the File Manager app in your hosting account dashboard to access your WordPress website.
- Visit the /wp-content/ directory.
- There you can locate a ‘plugins’ folder containing all your installed plugins.
- Now, we will deactivate all the installed plugins.
- For this, you will have to rename the plugins folder to plugins_backup.
- All the WordPress plugins installed on your website would now be deactivated.
- Log in to your WordPress website again.
If the issue of login is resolved, the cause of the error is clear then. Now, that you know that it is your plugin behind the error, you need to deal with the error causing plugins. You can refer to a tutorial on this. With the help of the tutorial, you will also be able to activate your WordPress plugins back, without causing any more errors.
Revert to the Default Theme:
After plugins, it could be your themes that you need to look for to resolve the issue of refreshing or redirecting to the login page in your WordPress website. It might happen after you have installed a faulty theme or it could happen after upgrading to a newer version of WordPress. The only possible way to make sure it is your theme at fault is to deactivate your theme.
- Use an FTP client to access your WordPress website.
- Visit the /wp-content/themes/ directory.
- Rename the theme directory to themes_backup.
- Log in bac to your WordPress website.
The issue might be resolved by now. If it is so, then you can now be sure that whatever the fault is, it lies with your theme. After a successful login to your WordPress website, you can try to reinstall a fresh copy of your theme and should try to log in again to your WordPress website. This is to ensure that the issue does not reappear again. If it reappears, the next option you have is to make a call to your theme’s support. Switching on to a different WordPress theme is also what we suggest here.