最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

"Too many redirects" ONLY when trying to access wp-admin page

programmeradmin1浏览0评论

I figured I would ask my own question seeing as the duplicate question(s) still haven't been answered.

For some reason after my fresh install of Wordpress 4.9.1 on my Ubuntu VPS, enabling my "flexible" SSL issued by Cloudflare, and finally switching my URLs in Wordpress (from "" to "") I can no longer access my admin panel.

Attempted Fix #1: Clearing browser(s) cookies, cache, and saved data, as well as any Cloudflare caches.

Attempted Fix #2: Modifying wp-config.php with the code:

define('WP_HOME' , '');
define('WP_SITEURL' , '');

Attempted Fix #3: Disabling .htaccess file in /var/www/html/

None of the above has worked and unfortunately I still cannot access the admin panel. However, the default wordpress homepage loads just fine at the correct secure, "https" URL.

I figured I would ask my own question seeing as the duplicate question(s) still haven't been answered.

For some reason after my fresh install of Wordpress 4.9.1 on my Ubuntu VPS, enabling my "flexible" SSL issued by Cloudflare, and finally switching my URLs in Wordpress (from "https://foo" to "https://foo") I can no longer access my admin panel.

Attempted Fix #1: Clearing browser(s) cookies, cache, and saved data, as well as any Cloudflare caches.

Attempted Fix #2: Modifying wp-config.php with the code:

define('WP_HOME' , 'https://foo');
define('WP_SITEURL' , 'https://foo');

Attempted Fix #3: Disabling .htaccess file in /var/www/html/

None of the above has worked and unfortunately I still cannot access the admin panel. However, the default wordpress homepage loads just fine at the correct secure, "https" URL.

Share Improve this question asked May 8, 2018 at 4:28 MattMatt 1,0411 gold badge8 silver badges6 bronze badges
Add a comment  | 

6 Answers 6

Reset to default 64

I found a solution that fixed my issue.

Sources:

A.) https://sharpten/blog/2018/01/17/wordpress-stuck-many-redirects-error-loop-using-ssl.html

B.) (Sublink within A) https://wordpress/support/article/administration-over-ssl/

Excerpt: Adding the following lines of code at the end of my wp-config.php file resolved the redirect conflict.

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
   $_SERVER['HTTPS']='on';

I used the above answer by Matt and added one else case as well:

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
   $_SERVER['HTTPS']='on';
else
   $_SERVER['HTTPS']='off';

It worked. I had also placed it at the beginning of the wp-config.php

Put this code in wp-config.php in the first line inside the PHP tag.

if($_SERVER['PHP_SELF']=="/index.php")
{
define('WP_HOME','https://yourdomain');
define('WP_SITEURL','https://yourdomain');
}
else
{
define('WP_HOME','http://yourdomain');
define('WP_SITEURL','http://yourdomain');
}

But don't forget to replace your site URL in the place of yourdomain

Somehow, our wp-admin folder permissions was set to 777, which means everyone can read, write or execute to this folder.

We logged onto the server, and found an error saying "wp-admin cannot be writable by group."

We changed our permissions so the folder was not writable by group or world (755), and the admin area was immediately accessible.

(This permissions change did happen seemingly randomly for us. Our website's team didn't even have access to the server at the time wp-admin just stopped working and we still don't know how this setting was changed. The site had been up for several years beforehand.)

I had the 'Too many redirects' on wp-admin only after migrating to a new server.

The problem was incorrect permissions on the folder wp-admin plus the top-level files within it. Resetting the permissions fixed the issue.

Hope that is of help to anyone who needs it.

In my case it was Apache's DirectoryIndex issue. The wp-admin was being accessed by wp-admin/index.php but not with wp-admin and showing ERR_TOO_MANY_REDIRECTS.

It sounds like Apache's DirectoryIndex may be set "incorrectly". Try resetting this at the top of your .htaccess file:

DirectoryIndex index.php

See the full answer here. Can't access admin dashboard with wp-admin without /index.php after it

发布评论

评论列表(0)

  1. 暂无评论