Cloudflare – WWW REDIRECT CHECK FAILED. For Cloudflare to work properly, all site traffic must go through WWW

Home Forums BulletProof Security Free Cloudflare – WWW REDIRECT CHECK FAILED. For Cloudflare to work properly, all site traffic must go through WWW

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #37969
    eveli
    Participant

    Hello!

    I was trying to set up Cloudflare CDN on a website where Bulletproof Security plugin was installed. A warning showing up in the hosting panel stating:

    “WWW REDIRECT CHECK FAILED. For Cloudflare to work properly, all site traffic must go through WWW” until I replaced the .htaccess file with Bulletproof Security code with the original .htaccess file code.

    Can anybody suggest what to do to allow both – Bulletproof Security and Cloudflare to work?

    Thanks in advance!

    #37970
    AITpro Admin
    Keymaster

    I googled that error message and it appears to related to DNS and not htaccess code or BPS.  See this Cloudflare forum post for more information on the cause of the issue > https://community.cloudflare.com/t/dns-check-failed-domain-name-problems/108546

    BPS and Cloudflare work together.  I don’t think the issue is related to BPS and is some sort of DNS configuration issue.  There are few different setup/configuration differences depending on how Cloudflare is “installed” on your website.  ie Cloudflare “installed” directly from your web host or directly “installed” from the Cloudflare website or using a Cloudflare WordPress plugin.

    Another possibility is that you previously had some Cloudflare htaccess code in your Root htaccess file that did something for Cloudflare related to www redirection.  I have looked around for Cloudflare help on this, but it is very difficult to find help for Cloudflare because there are 3 different “installation/setup” possibilities and the Cloudflare help information does not distinguish between which type of “installation/setup” that a person may have and the differences between the different “installation/setup” types.  BPS creates backups of your root htaccess file in this folder:  /wp-content/bps-backup/master-backups/.  The backup files are named using a date/timestamp:  root.htaccess-{date-timestamp}.  If you find some Cloudflare htaccess code in a root htaccess file then post it in your forum reply so I can take a look at it.  I still think this issue has to do with DNS or some other web host configuration thing though.

    #37975
    eveli
    Participant

    I checked the previous .htaccess code and the only code that is there, is BPS code.

    As I had installed Cloudlfare directly from the host, I contacted the hosting provider at first to solve the issue with redirect and I got a reply that there was a rule in the .htaccess of the site that did not allow to properly redirect to WWW version. The hosting provider changed the .htaccess file to the default WordPress .htaccess file and the problem with redirect was solved.

    As the only code in .htaccess file was BPS code, I believe the cause for the issue is this code. What do you suggest?

    #37976
    AITpro Admin
    Keymaster

    The BPS htaccess file also contains the default WordPress htaccess rewrite code.  A standard BPS root htaccess file should do the exact same thing as a default WordPress htaccess file.  The only logical thing I can think of is that some additional custom htaccess code was added to BPS Custom Code that is causing the redirect/rewrite problem.  Copy your entire BPS root htaccess file code and post it in your forum reply so I can take a look at it.

    #38027
    eveli
    Participant

    This was the .htaccess file with which Cloudflare was not working:
    Do you know where the problem is?

    [Standard BPS root htaccess file – checked and deleted by AITpro Admin]

    #38028
    AITpro Admin
    Keymaster

    The BPS root htaccess file code that you posted is the standard BPS root htaccess file code without any additional custom htaccess code added in/to it.  The standard BPS root htaccess file/code does not interfere with Cloudflare.  Post your original htaccess file that works with Cloudflare so I can take a look at it.

    #38030
    eveli
    Participant

    This is the code of .htaccess file that works with Cloudflare:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    #38031
    AITpro Admin
    Keymaster

    hmm yeah that is standard default WordPress Rewrite htaccess code, which is exactly the same as the code in the BPS Root htaccess file.  BPS breaks up the lines of standard default WordPress Rewite htaccess code in the BPS Root htaccess file, but the code is exactly identical.  Maybe what is happening is your web host itself checks for the standard default WordPress Rewite htaccess code in the exact format that WordPress uses and displays that error message if the code does not match exactly?  You are going to need to contact your web host and ask them why this problem is occurring.

    #38035
    eveli
    Participant

    Thanks, will do that!

    #38666
    AITpro Admin
    Keymaster

    Edit|Update: The same problem returned after 1 day and clicking the “refresh” link in the error message fixed the problem again and allowed access to the “Manage Cloudflare Settings” panel again. So this is a bug in the Cloudflare tools and error checking code itself. Luckily the solution is simple – just click the “refresh” link in the error message if you see this error message in the future.

    Another person ran into this same exact or similar problem.  What worked was to add this BPS HTTPS/SSL Rewrite htaccess code here > https://forum.ait-pro.com/forums/topic/wordpress-ssl-htaccess-code-rewrite-ssl-rewritecond-server_port/#post-7233 and then to click the “Refresh” link in the SiteGround WWW REDIRECT CHECK FAILED error message. If someone else runs into this problem then another thing that may also be needed is to do the steps below.

    Important Note: You should be using the BPS HTTPS/SSL Rewrite htaccess code if you have an HTTPS/SSL site, but you may also need to do this additional fix below.

    1. Copy the htaccess code below into this BPS Root Custom Code text box:  1. CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE
    2. Click the Save Root Custom Code button. Note: If you are unable to save your custom code due to ModSecurity installed on your web host server then click the Encrypt Custom Code button first and then click the Save Root Custom Code button.
    3. Go to the Security Modes page and click the Root Folder BulletProof Mode Activate button.
    4. Now in your SiteGround control panel under your Cloudflare settings click the “Refresh” link in the WWW REDIRECT CHECK FAILED error message.
    5. You should now be able to see and have access to the “Manage Cloudflare Settings” panel.
    6. Go back to BPS Root Custom Code and delete the htaccess code you added in this BPS Root Custom Code text box:  1. CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE.
    7. Click the Save Root Custom Code button. Note: If you are unable to save your custom code due to ModSecurity installed on your web host server then click the Encrypt Custom Code button first and then click the Save Root Custom Code button.
    8. Go to the Security Modes page and click the Root Folder BulletProof Mode Activate button.

    Note: Change example.com to your actual website domain name.

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.