Viewing 2 replies - 1 through 2 (of 2 total)
  • SystemRevolution

    (@systemrevolution)

    You can use the “enhanced text widget” plugin to add a code in any sidebar that lets you properly redirect the browser to the secure version of your site (https), because do the way you do, generates precisely that loop which you are suffering. The code is shown below:

    <?php
     functiontosendhttps();
     function functiontosendhttps(){
     ?><script type="text/javascript">
      if(location.href.indexOf('https:')==-1) location.href=location.href.replace('http:','https:');
     </script><?php
     }
    ?>

    If you use your own plugin to add code to WP, you can use the following code (which in fact is the correct way to do it)

    add_action('wp_head','functiontosendhttps',1);
     function functiontosendhttps(){
     ?><script type="text/javascript">
      if(location.href.indexOf('https:')==-1) location.href=location.href.replace('http:','https:');
     </script><?php
     }

    To solve the redirection loop, you can run the following SQL query on the database that manages your WP installation

    I tried to put the code as is, however, the site modifies it, preventing it from place properly, so I put it in Base64, to see it properly, simply drag it to the address bar or a new tab.

    data:text/plain;base64,VVBEQVRFIGBwcmVmaXhfb3B0aW9uc2AgU0VUDQpgb3B0aW9uX3ZhbHVlYCA9ICdodHRwOi8vd3d3LmZveGFuZGhhcmUubmV0Jw0KV0hFUkUgKChgb3B0aW9uX25hbWVgID0gJ3NpdGV1cmwnKSBPUiAoYG9wdGlvbl9uYW1lYCA9ICdob21lJykpOw==
    In this example, the installation prefix is “prefix_” and obviously you must change it according to your installation.
    I hope it works for you, greetings

    zaidapicazo

    (@zaidapicazogmailcom)

    Hello, thanks four your support.

    I’ve got the same issue, I can’t use the plugin because when I set ssl in pages secure it goes to a redirect error.
    I tried the code you said before in functions.php `add_action(‘wp_head’,’functiontosendhttps’,1);
    function functiontosendhttps(){
    ?><script type=”text/javascript”>
    if(location.href.indexOf(‘https:’)==-1) location.href=location.href.replace(‘http:’,’https:’);
    </script><?php
    }`
    But it is even worse, the website is completely wrong, not reading many files (css…) and the code is changing all the time online. Very strange.

    As well, could you explain me about the database check? Thanks!

    I have it contracted with the hosting people but I don’t know why I can’t set https and anything I do it redirects to a loop error.

    Could you help me?
    Thanks in advance
    Best,
    Zaida

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect Error’ is closed to new replies.