There is a very ugly error that can sometimes arise in a WordPress site whereby, when accessing the administration of your website, it returns you to the front page and there is no way to access it . Your site is visible but you cannot manage it, or add new content or anything, you cannot enter the WordPress administration.
A sneak peek at this is usually a URL like this:
http://misitio.es/wp-login.php?redirect_to=http%3A%2F%2Fmisitio.es%2Fwp-admin%2F&reauth=1
There may be several culprits, namely:
- A recent domain / server migration.
- After a multisite WordPress activation.
- After a deactivation of WordPress multisite.
- A failed WordPress update.
- Plugins.
- Theme.
- Cookies that do not expire.
- Persistent cache.
- A corruption of database tables for any of the above or other reasons.
And if it is already difficult to find the problem, do not think that finding the solution is easier. However, there are quite a few ways to try to solve it so let’s see them and try to find yours. You don’t have to do everything, just try one by one until you find which one solves the problem, okay? …
- Before starting add the line
define ('WP_DEBUG', true);
to the wp-config.php file to see the errors that are generated and can give you clues.
- Empty your browser’s cache , exit and start it again. Try to enter now.
- Use another browser that you do not usually use and try to enter. If you get it, empty the cache of your usual browser.
- Open an incognito session from your browser, or use Tor’s , to avoid problems with cookies.
- Clear your browser cookies and try to enter again.
- Reinstall WordPress manually via FTP or cPanel, replacing all files and folders from the previous WordPress installation with the new one, except the / wp-content / folder. Try to enter now.
- Force the disconnection of your site by typing the URL (replace yoursite.es with your clear domain), empty the browser cache, close it, open it again and try to enter again.
- Rename the folder / plugins / by FTP or cPanel to, for example / plugins-off / and try to enter. This action disables all plugins. Try to enter. If you succeed, rename the folder to its original name and activate the plugins one by one until you find the culprit.
- Rename the active theme folder from FTP or cPanel to force WordPress to activate the default theme (twenty-whatever). Of course you should have some twentysomething installed, if not you upload it manually first. Try to enter now.
- Disable the server cache if you have any active, empty the browser cache and try to enter again.
- Delete the .htaccess file and try to enter the administration. If you succeed, change the URLs of the site and WordPress in Settings -> General from www to without www or vice versa, another possible culprit for the error. Then go to Settings -> Permalinks and save changes without touching any settings so that the .htaccess file is re-created.
- An alternative to the previous trick is to manually define the URLs to use, force them, adding the following lines to your wp-config.php file:
define('WP_HOME','http://tusitio.es'); define('WP_SITEURL','http://tusitio.es');
or …
define('WP_HOME','http://www.tusitio.es'); define('WP_SITEURL','http://www.tusitio.es');
- If you recently disabled Multisite, go to your wp-config.php file and add the following line to enable it:
define( 'WP_ALLOW_MULTISITE', true );
Try to enter now. If you succeed, install and activate this plugin and then set all its settings to the default values to erase possible bad previous configurations.
- Check the permissions of the wp-admin , wp-includes and wp-content folders to verify that they are 755 and if not, change them. Try to enter.
- Deactivate the CDN , if you have any service of this type active and try to enter.
- Open your wp-config.php file and change the unique authentication keys (the salt cookies ) by obtaining new ones from https://api.wordpress.org/secret-key/1.1/salt /. Save the changes and log back in.
- It could also be a problem similar to the infinite redirect of WordPress Multisite so add the following to the wp-config.php file, save the changes and try to enter again.
define('ADMIN_COOKIE_PATH', '/'); define('COOKIE_DOMAIN', ''); define('COOKIEPATH', ''); define('SITECOOKIEPATH', '');
- Check your utility plugin and the active theme’s functions.php file to verify that no custom redirects are active. If you find it, delete or comment on the lines that activate it.
- Review the .htaccess file and check if a security plugin has added a line that generates a redirect after accessing the administration and delete or comment it. When in doubt rename or delete the .htaccess file (remember to save a backup copy first) and try again.
- If you have recently activated the HTTPS version of your site, review each change made to achieve it and revert it to the default values (lines of code in .htaccess or wp-config.php , change of site and WordPress URLs, etc.)
- Access your database using phpMyAdmin from your hosting panel and locate the wp_options table (or loquesea_options) and checks URLs WordPress site and have the correct values.
- In PHPMyAdmin check that the table sizes are correct . When in doubt, select the main WordPress tables, optimize and repair them .
- From PHPMyAdmin locates the wp_usermeta table (or loquesea_usermeta if, happily, do not use the prefix wp_). Now find the rows with the title of session_token and delete all the values they contain.
- … And if you don’t get it with any of the previous tricks, you have no choice; Restore a backup of your site, including the database, from the day before the redirect failure began, which brings us down the path of bitterness.
It is a bloody error that, fortunately, is not very common but when it arises it is quite annoying until you find what is causing it.
It has happened to me several times on client sites and I have (almost) always solved it with one of the tricks exposed here. And if not, there is always to resort to the blessed backup copies .
If you know any other way to solve it that I have missed, it takes time to tell in the comments , more than one will thank you.
YOU MAY ALSO BE INTERESTED IN …
Did you like this article? You can’t imagine what you’re missing on YouTube !