Redirect loop on wp-admin or wp-login.php

2019-03-30 08:27发布

I put together a quick WordPress site locally using MAMP, then checked it into an SVN repo. I then checked it out on to my development server.

I didn't change anything except to run the search and replace tool script from Interconnectit to updated the URL of the site in the database on the server.

Initially, I got a 500 server error. Checking the logs, I discovered that this "SoftException" was because index.php was writeable by group - the permissions were 664. No problem - a quick change of permissions to 644 sorted that. So now the frontside was working.

However, strangely, the admin side of the site did not work. It just produced an endless redirect loop in all browsers.

Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

Nothing has changed since the local development version. The htaccess file is just a standard WordPress one. Nothing weird... still working fine locally.

So what's going on?

14条回答
何必那么认真
2楼-- · 2019-03-30 08:54

I was getting DoS pages when trying to publish in my WP site. I found advice that changing permissions in the function.php file to 600 could solve the issue, also to add to that file a script snippet . It was a WP help page. I was able to get to the publishing in a work-around way. Still have the DoS when I try to open the editor.

查看更多
该账号已被封号
3楼-- · 2019-03-30 08:55

I just had to flush my redirects. Since I couldn't access the Admin I added this to the top of my functions.php file:

flush_rewrite_rules(); exit;

Saved it and refreshed my site. Then remove the code from your functions.php file and then refresh again. That did it for me.

I also think it might be a good measure to resave your permalinks.

PS. I think the main issue came from theme-my-login as it was redirecting to /login.

查看更多
Melony?
4楼-- · 2019-03-30 08:56

To remove the lines

define('DOMAIN_CURRENT_SITE', 'www.sitename.de');

define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

from wp-config.php should do the job.

These lines are not necessary for a multi

查看更多
聊天终结者
5楼-- · 2019-03-30 08:57

I had a similar issue in my case it was due to restoring a db script that was created with WP Migrate DB. The script had merge tags in like "## DEV URL ##" which i needed to fix before running the script on mysql and pointing the wp-config.php to the correct database.

查看更多
对你真心纯属浪费
6楼-- · 2019-03-30 08:58

My problem was that the hardisk was full. Trying to log into the wordpress administration panel was redirecting me to wp-login.php. I was able to log in again the moment I deleted some files.

查看更多
ら.Afraid
7楼-- · 2019-03-30 09:00

Checking the permissions of wp-login.php revealed that they too had somehow been set to 664 - the same permissions that caused index.php to fail and caused the 500 server error.

I changed the permissions of wp-login.php to 644 and hey presto, the WordPress login page showed up.

But on logging in, another redirect loop. So, once again, looking at /wp-admin/index.php, the permissions were 664 rather than 644.

Fixing them led to problems with the next files in line - the dashboard was a right mess. One by one, changing from 664 to 644 corrected the issues (/wp-admin/load-scripts.php, /wp-admin/load-styles.php).

So it became obvious that a recursive change of permissions was the only way to sort things out.

My UNIX isn't exactly top notch, but this appears to have worked (running from Mac OS X Terminal). I ran it from the root directory of this WP install.

find . -type f -perm 664 -print -exec chmod 644 {} \;

There might be a better command, but I understand this to mean "find all files with 664 permissions and change them to 644".

It has fixed my problem.

查看更多
登录 后发表回答