wp-admin redirecting to wp-login.php?redirect_to=

I have several sites now that redirect the wp-admin page like this:

http://mydomain.com/wp-login.php?redirect_to=http%3A%2F%2Fmydomain.myhostingdomain.com%2Fwp-admin%2F&reauth=1

This started happening when I moved the sites from one hosting account to another on the same provider. I’ve moved sites in the past, using backupbuddy to back up from my dev server and then move them to their final resting place and they don’t have this issue. I moved these the same way. But I also have another site that I didn’t move, didn’t touch it, and it also started doing it.

I realize I can login at wp-login.php, and when I do, I get into the dashboard just fine. The problem is, I have monitoring software that syncs with my sites, and now it is failing. It cannot communicate with the site, because it needs to confirm the site at wp-admin with the proper credentials. If it redirects, it thinks there is a problem and throws an error. Also, I just don’t want anyone seeing their domain as the subdomain.myhostingdomain.com in the URL if they are in the admin panel.

On the host, the hierarchy looks like this:

public_html/myhostingdomain/clientdomain

Client domain is assigned to the subdirectory, so it is as though it is at root. On other sites, and on these sites before, I have/had ‘Wordress Address’ and ‘Site Address’ as http://clientdomain.com in General Setting and it was working fine. .htaccess hasn’t changed, since all that happened was it moved from one hosting account to another, same provider, same directory structure, etc.

I’ve searched the internet and see a few posts, but no solution, and not really the same reason.

Any ideas as to why it is redirecting? Nothing in functions file, nothing in .htaccess that I can see that would cause it.

A site for reference, and one that I have enabled support access to is captionsunlimited.com

Thanks!

  • Rupok
    • DevOps Support

    Hi fjhughes,

    So sorry to hear the inconvenience you are having. To investigate the issue, can you please turn on debug mode in WordPress? To enable it, open your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:

    define('WP_DEBUG', true);

    In order to enable the error logging to a file on the server you need to add yet one more similar line:

    define( 'WP_DEBUG_LOG', true );

    In this case the errors will be saved to a debug.log log file inside the /wp-content/directory.

    Depending on whether you want your errors to be only logged or also displayed on the screen you should also have this line there, immediately after the line mentioned above:

    define( 'WP_DEBUG_DISPLAY', false );

    The wp-config.php is located in your WordPress root directory. It’s the same file where the database configuration settings are. You will have to access it by FTP or SFTP in order to edit it.

    Past errors here. If file is very long, paste them to a text file and attach with your reply.

    Can you also try repairing your database? To know how you can do this, you can check this guide: http://www.wpbeginner.com/wp-tutorials/how-to-fix-the-error-establishing-a-database-connection-in-wordpress/

    Please provide us the debug data and the result of database optimization. If these don’t resolve the issue, we will be glad to investigate further.

    I’m looking forward to hearing from you and resolving this issue as soon as possible.

    Have a nice day. Cheers!

    Rupok

  • fjhughes
    • New Recruit

    Hi,

    I turned on Debug mode, and logged errors, and also tried database repair. Database repair returned no errors and listed all tables as already optimized.

    I received no errors when going to the page, so I did not see any display, no are there any log files in the wp-content directory. I turned on Firebug and navigated to the address and also saw no errors in the console.

    It’s somehow redirecting, so I do not think it is an ‘error’ per se, just strange that it is redirecting. I have tried from other browsers and even other computers that I know have never been to the site before to confirm that it isn’t something in my cache.

    Something else to note, and I’ve never had to do this before, when I tried it from a different browser with a clean cache, it went to clientdomain.myprimarydomain.com and said not found. I went to my DNS and added a CNAME record for that domain and then it worked, but still with the redirect to wp-login.php. I’ve never had to add the CNAME’s before in the past to get someone’s site working, and the site works fine, it’s just getting to wp-admin.

    Thanks for any further investigation you can think of.

  • Nithin
    • Support Wizard

    Hey fjhughes,

    I hope you don’t mind me chiming in, did you check whether any plugin is causing this redirection? Since I don’t see you mention about performing about plugin conflict test, and you have tried all the other steps in troubleshooting this, just to be sure, could you please run a quick plugin/theme conflict test as illustrated in getting support manual (flowchart), and rule out whether any plugin is causing this issue.

    http://wpmudev.com/manuals/using-wpmu-dev/getting-support/

    I hope this might give you a clue, please let us know how that goes. Have a nice day. :slight_smile:

    Kind Regards,

    Nithin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.