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

前端 未结 16 4156
温柔的废话
温柔的废话 2021-02-09 18:30

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

16条回答
  •  旧时难觅i
    2021-02-09 18:54

    If you're using Cloudflare you might want to try adding this to the TOP of your wp-config.php file:

    define('WP_SITEURL', 'https://www.example.com');
    define('WP_HOME', 'https://www.example.com');
    define('FORCE_SSL_ADMIN', true);
    define('FORCE_SSL_LOGIN', true);
    if(isset($_SERVER['HTTP_CF_VISITOR']) && strpos($_SERVER['HTTP_CF_VISITOR'], 'https')){
      $_SERVER['HTTPS']='on';
    }
    

    It's important that you add it to the top of the wp-config.php file or you'll end up with "Sorry, you are not allowed to access this page" error messages.

    Credit: https://www.meltajon.com/dev/wordpress-wp-admin-redirect-loop-with-cloudflare-ssl

提交回复
热议问题