wp-login.php?redirect_to=https problem

Please forgive me if I am posting in the wrong place but I am here to see if you can help me with some minutes of your time.

The problem is a website showing persistent internal errors all around the wp-login.php. I am able to login and access the front end with no difficulties. I have tried to debug but the errors do not show up o any pages. I have tested the theme, the plugins, etc etc I checked the htaccess file for corruptions (there are no corruptions) and I set the htaccess file up to debug and display but nothing showed. I did check the debug file on the server end it showed some errors around one plugin and when I deactivated that plugin there was no change with the Internal Errors. The host says that they can't see a problem. PHP is running at 7.2 PHP Memory is sufficient checking if the files and folders have the correct file permissions.

When I use an analysis tool such as Screaming Frog there are 15 links raising the internal error 500..and on occasion I have been redirected to a 'are you human' verification page with a tick box (this is because the host has brute force attack protection in place on the server and they cannot remove protection for just my website).The wp-login.php seems to redirect back to the main domain and an image but the standard message 'INternal Server Error 500' can be seen on the screen. One of the links looks like this:


I'm hoping that someone here will have experienced this before or know what to do. I understand it's a process of elimination and I have done a fair bit so far.

Or is there a way I can check if that redirect is actually present somewhere so I can unlink it? I mean a redirect from https://example.com/wp-login.php?

I also heard that there might be links in the database which are redirecting it to such links as the one that I showed above.

Many thanks for your time in advance

ps: logging in on the front end is fine, but the errors show in Screaming Frog Spider Crawl and other analysis.


1 Answer 1


Add the below code into your functions.php file

function redirect_login_page()
    $login_page = home_url('/login/'); //your redirect page link here
    $page_viewed = basename($_SERVER['REQUEST_URI']);

    if ($page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
add_action('init', 'redirect_login_page');
  • Hi and thank you very much for your reply. Please can you tell me why and what this code will do essentially? Many thanks to you
    – mmolar
    Sep 7, 2018 at 20:39
  • I added the code you suggested and it didn't work.
    – mmolar
    Sep 7, 2018 at 21:14
  • Hi you mentioned in the code: your redirect page link here. Maybe I didn't add it correctly, to what are you referring when you say 'your redirect page link here'. In what context shall I add it?
    – mmolar
    Sep 7, 2018 at 21:21
  • Here is an example of one of the links again: https:// example.com/wp-login.php?redirect_to=https%3A%2F%2Fexample.com%2image-name-goes-here%2F Thanks a lot
    – mmolar
    Sep 7, 2018 at 21:24
  • Debug: 23:34:09 GMT+0100 (British Summer Time) Methods with the same name as their class will not be constructors in a future version of PHP; secure_html5_video_player_widget has a deprecated constructor Type: PHP Deprecated Line: 23 File: / home/cluster-sites/6/n/website. com/public_html/wp-content/plugins/secure-html5-video-player/sh5vp-widgets.php Today 23:33:03 GMT+0100 (British Summer Time) Function create_function() is deprecated Type: PHP Deprecated Line: 265 File: / home/cluster-sites/6/n/website. com/public_html/wp-content/plugins/file-manager/BootStart/BootStart.php
    – mmolar
    Sep 7, 2018 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.