Do This When Wp-admin Redirects To 404 Page Or Refreshes
last week, when I tried to access my WordPress dashboard through WP-admin slug, it showed me a 404 page.
So what that meant?
Quite clearly, it means my WordPress installation was not able to find and retrieve the data from the WP-admin directory.
If the same has happened to you, don’t worry. We can solve and get rid of this problem very easily.
It takes only a minute or two. Also, In this tutorial, I will try to simplify the complicated processes as much as I can so if you are a beginner, there’s no need to get nervous.
Remember to take a complete backup of your database before starting out with any of the given procedures.
Let’s get started!
Finding The Cause Of The WP-admin Redirection & Refresh Error
It may happen that every time you hit the login button even with the correct credentials, the page gets refresh and you are returned to the same page and fate as well. The first step you need to take is finding the cause of this problem.
There are several known reasons which might occur and force wp-admin to redirect either to the homepage, wp-login page (refresh error) or a 404 page in the worst-case scenario.
1. Plugin Conflict
Some plugins and the majority of them which are related to secure WordPress are the root cause of this error.
Plugins like hidden login URL slug, 404 managers, security plugins such as Wordfence, etc. create conflicts that other plugins you might have installed.
To check if the main cause of your wp-admin redirect problem is a plugin or not, You have to look through your FTP client.
Since you can’t log in to your WordPress dashboard, you will need to access your plugins directory through an FTP client. FTP or the file transfer protocol helps you to connect your device to your server at the administrator level.
You can use Filezilla or CoreFTP as they both are helpful for beginners as well as high on features.
Here’s how to log in with FTP:-
- Get your FTP access credentials (ask your host)
- Download and install Filezilla on your PC
- Login to your server
Then head on to the WP-content folder which can be located in the public.html folder.
Here in the plugins directory, start deleting the plugins one by one. After deleting every one plugin, go back and try to login to your WordPress dashboard. If you are able to log in after deleting any plugin, that means the cause was a plugin conflict.
This usually happens and will solve the issue in most cases.
If the problem still persists, you should check out the other reasons below.
2. Theme Conflict
Themes, the same way a new or an old plugin can be a cause for Wp-admin redirect problems, can be responsible for this error.
For inspecting if the wp-admin redirection problem is occurring by any theme update, change or functions.php file changes, you will have to repeat the same process as you did in the case of plugins.
In this process, you will have to delete the theme by deleting its existence in your themes folder that is located near your plugins directory in the same wp-content folder.
Try deleting the themes, and at the same time try to log in to your WordPress dashboard. This should solve your problem.
If the wp-admin redirection/page refresh problem still persists, do check out the other steps below.
3. Reach Out To Your Web Hosting Support
If neither theme nor the plugins were the cause, it probably means that the problem is with your allocated server i.e. your host.
Before you reach to your hosting support team, let’s make sure the problem is with the servers. For doing this, you will need to launch your PHP my admin area.
PHP my Admin software is used to access the MySQL and MariaDB database. WordPress database is written and runs on MySQL and MariaDB.
To confirm your host is causing this problem, try launching PHP my Admin and access your MySQL database. If you succeed, congrats, your servers, and the host both are fine and working.
If you are unable to access your MySQL database and PHP my admin shows failed login error, you need to ask your host. Contact their support team and they will provide you with all the necessary details on this issue.
If they fail to help you, it is time to move to a better host such as DreamHost.
4. .htaccess File Corruption
It may happen that you added code in your .htaccess file. It may also happen that you never knew about it and did nothing.
.htaccess is a sensitive file that helps WordPress to handle requests between a server and a web browser and it should be handled carefully. Sometimes, it gets corrupted due to reasons like plugin conflicts.
All we have to do to get rid of this wp-admin redirect error is delete this corrupt .htaccess file.
Simply log in to your FTP client, take a backup of the existing .htaccess file and then delete this corrupt .htaccess file. That’s it.
Go back and check if you can no login to your WordPress dashboard or not. Once you are in your WordPress admin area, go to the settings section and get to the permalinks settings. Do not change anything and click on save. This will generate a new, fresh .htaccess file.
If this didn’t solve your problem, then follow the steps below.
5. Site URL Error
In some cases, when none of the above-mentioned solutions worked this did.
Sometimes, simply updating the site URL solves the problem. All you need to do is:
- Login to your FTP client area
- Locate the WP-Config file
- Take a backup of it
Then edit it and add this line of code:-
Replace the “yourdomain.com” with your original domain.
That’s it. Go back to your wp-admin page and try to log in again.
6. Cookies And Cache
If you are still not able to login to your WordPress dashboard, You may need to clear your cache and cookie files.
Cookies enable and help the WordPress authentication and memory process. When you hit the remember me checkbox, it’s cookies that do the function of saving your password and username in the browser.
All you need to do is clear all your browser cache and cookie files but make sure to keep them enabled. Then close your browser and restart it.
By now, you should have gained your access back to the WordPress admin dashboard.
In some cases, you may have to wait a couple of hours before you gain access to your admin area.
If this error keeps happening repeatedly, then there may be something wrong with your web host. Try contacting your web host support or consider migrating to a better web host.
I hope this guide has helped you. You should also check out the guide on how to fix “WordPress service unavailable”.
Do leave a comment below and mention which method worked for you.
Amazingly helpful page!!
In my issue case it was point 4 – a bug in the htaccess file – i deleted it and immediately was able to log into my admin dashboard again!
And yes i also did create a fresh htaccess file as advised.
I initially thought that my entire page got hacked and was lost – my page got hacked once before a while ago with some creature appearing in my front page (was a bug under comments)
Hi Andy, I’m happy to help you and I’m more happy that my tutorial solved your problem. To make sure your WordPress blog doesn’t get hacked again, Install some security plugins.
Don’t delete the plugins, just rename the folder to name_of_plugin-OFF
Probably deleting one by one is a better option as in most cases you won’t be able to use the trouble causing plugin again.
404,Seriously, thanks a lotttttttt. Today I just tried to login and was seeing error 404 and I started looking for solutions and tried everything. But in the end, clearing the browser cache helped me to get my login page. Seriously thanks a lot man. Bless you!
Glad to help 🙂
Well done thank you.
Was htaccess file in mine.
Except for my home and login pages, all the published pages on my website result in a 404 error. The slugs are all correct. Do you know what could be wrong? It used to work only when my permalinks were set to plain (I want them set to post name), but now it doesn’t work at all. I’ve already disabled plugins individually and tried changing the theme, but none of that worked. I’ve also tried your suggestions 4 and 5 here without success and confirmed it’s not a cache issue.
Hi Emily, did you change your permalink settings recently?
Thank you for replying, Aayush!
I did change my permalink settings, but it is quite a number of days back now.
I’m suddenly not sure if I’ve done your suggestion 5 correctly. I now have those two lines of code across the top of my site. I’m about to edit them out again.
Hi Emily, It could be that you change the permalink settings after you published all those blog posts, pages and media files. That breaks all the previous links.
It’s a new website, so I have much of anything on it. I have a blank home page, which works, a blank services page, an about me page with a heading, and a blog with the automatic post that new WP sites get. No matter how you try to get to one of those last three pages (whether it’s clicking on them in the navigation menu or typing in the url), you get a 404 error. When I add a new published page, the same thing happens to it.
Without looking at the backend of your website, it’s hard to pinpoint the issue.
Thanks a lot. Searched for an answer for 2 days. Glad I found this post. Clearing the browser cache solved the issue.
Thank you very much! A great help. clear and helpful
There are a few points that I remembered in my head, but since I haven’t used it for a long time I had forgotten some.
In my case it was the HTACCES and it solved my problem! I’ll keep the page as a reference if it happens again, like a memo 😉
Hello everything is fine? Thank you for the tips! In my case, I have a problem when updating an already built page. I enter the page, make the changes and when I click on UPDATE, the message “error 404” appears and the page does not update. The most curious thing is that I can turn plugins on and off, upload images, upload banners in RevSlider. When refreshing the page, this error occurs. Can you help me?