-
When I try logging in to wp-admin (or even wp-admin/index.php) I simply get redirected to my site’s homepage.
(after authenticating successfully – i.e. It DOES accept my login credentials (so its not an account, password or blacklisting issue), but simply wont go to the admin dashboard page after login)
(I suspect it may be an infinite loop that is occurring?? – how do I find out?) -
But I CAN login if I go directly to the wp-login.php page, which is weird.
(but this is not acceptable as I need users to be able to login through a custom login page again) -
This came about seemingly randomly
(I hadnt changed anything in a week – just woke up one day and couldnt log in) -
Preceding factors:
- I havent moved the site at all
- I havent changed the domain, urls or anything
- no cache-ing plugins present
The week before I had:
Updated WP to 4.8
Updated PHP from 5.4 to 5.6
(to allow installation of an SEO plugin add-on – ‘SEO framework extension manager’)
But it had been working fine for days.
- So to given some reporting this after PHP upgrade, I tried setting my PHP back to 5.4, but no luck.
- then up to 5.5, and then back up to 5.6 again – still no fix.
I do also have a membership plugin that renames the login page to /login
(But that has worked fine for years too)
I have tried all the usual fixes for wp-admin login issues:
– I have tried multiple browsers, and cleared their cache and cookies – no fix.
– I have disabled every plugin one by one (via ftp folder rename) – no fix.
– even re-updated WordPress to 4.8 again (in case any of the core files needed replacing)
-
checked file and folder permission are all correct (644) via FTP – all fine – no fix.
-
I have tried adding lines to the wp-config.php file – with no luck
Such as
define(‘WP_HOME’,’https://warrenmaginn.com‘);
define(‘WP_SITEURL’,… etc.
define(‘FORCE_SSL_ADMIN’, true);
define(‘FORCE_SSL_LOGIN’, true);
even this solution offered at kinocreative:
@define(‘ADMIN_COOKIE_PATH’, ‘/’);
-
when I remove the htaccess file altogether, still no fix
(but I do actually get a 404 error page whenever I try access any other page than the root domain, when I dont have the htaccess in place)
(which may mean something in the htaccess i needed to correctly link in my site – but my htaccess hasnt changed, and if I edit it down just to the canonical rewrites (I use SSL sitewide, and do not ever use www in any references to my domain (have checked across database etc.) -
I have tried inserting the text “die(FILE‘:’.LINE);” on every line of the wp-admin/index.php file
(to trouble shoot it – and it stopped (without redirecting) even after placing the line all the way at the bottom of the file – so I imagine this means the issue is not in this file) -
Any other files I should try this in?
- Or debug modes I can use track this down?
Any suggestions would be VERY appreciated
(this is doing my head in)
Thanks in advance for offering your wisdom…
5
Answers
Warren,
First of all, delete the codes you inserted in your wp-config.php. Instead, put it before your the require_once(ABSPATH . ‘wp-settings.php’):
If your website uses SSL, don’t add any rules to wp-config or htaccess because it may result in 500 internal server error. To force the use of SSL, install “Really Simple SSL” and clear your htaccess, leaving only the necessary:
Now, go to your php settings and set error_reporting as “E_ALL” and verify what the logs says (if you want to fix it by the hard way).
But you can go to your file manager and change the plugin folder name to “plugin.old”. It will say if there are any plugins causing the problem. If it is, you could disable each plugin to discover which one is giving you this headache.
If plugins is not the real cause, I’d try to upload a fresh version of your WordPress (you can find it here ~~ https://wordpress.org/download/). Remember to rename wp-admin and wp-includes to wp-admin.old and wp-includes.old, respectively before unzip the fresh ones. Don’t forget to delete all the root folder WP files except wp-config.php.
I’m looking forward to receive your answer.
You have 301 or 302 redirect, do you have some plugins that makes redirects? Or probably it can be written in your .htaccess file.
Was checking a similar issue..
When entering the credentials on wp-admin page it redirected to homepage.
Changed htaccess to default, checked wp folder permissions.. all good.
Found it was a corrupt database. Since I had access to WHM. I used the database repair feature.
Voila!
IT WORKED !!!
For those facing this, you might add a new icognito page and visit again, sometimes its due to caching. if its still not working, might be your htaccess file issue.
I repaired the database through phpMyAdmin, selecting all the tables and choosing repair, and I was able to log in immediately.