wp-admin redirect loop on https
Running your website on HTTPS has many benefits which doesn’t stop at being safer, it also allows you to run on http2/SPDY and offers things like Service Workers.
I use CloudFlare and their Flexible SSL to secure most of my sites. It’s easy to set up and it costs nothing which is just amazing as the upfront and on going costs are ofter a barrier for HTTPS.
When I updated WordPress to use https://theuniverse.is under
General > Settings I suddenly had an issue with the
/wp-admin/ throwing redirect errors.
Fixing the Redirect Loop
After a lot of searching on the web I found the answer in a couple of different wordpress threads.
You need get FTP access to your
wp-config.php file and drop in the following snippet
define('FORCE_SSL_ADMIN', true); define('FORCE_SSL_LOGIN', true); if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';
That pretty much fixes it…. pretty much
Fixing “You do not have sufficient permissions to access this page.”
So while the above update fixed the redirect problems I was now faced with the error that I can not access the page due to insufficient permissions.
After a quick search I found that you need to paste the above code ABOVE the following code:
/** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
I hope that helps any issues you’re having.