Surf the Dream A discourse of links and articles from Justin Avery

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 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')

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.

  • Piotr Galas

    thanks for this post. It save my time.

Surf the Dream is a blog that has been running since the mid 2000's when it started on BlogSpot. Over the years it's been rebranded as (now my resume) and (which now redirects back to this site).

I offer consultation services through Simple Things, produce a range of high quality pocket notebooks(including a Solar System Notebook, Space Notebook, and a Guitar Notebook), write about the Universe and run a responsive web design knowledge hub and a RWD Weekly Newsletter.