CloudFlare – CloudFlare htaccess Code

Home Forums BulletProof Security Free CloudFlare – CloudFlare htaccess Code

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1539
    AITpro Admin
    Keymaster

    Email Question:

    I am using cloudflare on my site and it adds something to the htaccess file and when it does my site doesnt load. Can you please help me to integrate this correctly so that my site works. here is the code

    # Start CloudFlare:highratedhosting.com rewrite. Do not Edit
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^highratedhosting.com
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    # End CloudFlare rewrite.
    #1540
    AITpro Admin
    Keymaster

    I believe you would want to add this CloudFlare htaccess code somewhere at the top of your root htaccess file and after any cache htaccess code such as W3TC or WPSC htaccess code.  Try adding it here in your root .htaccess file.

    # BULLETPROOF .47.8 >>>>>>> SECURE .HTACCESS
    
    # If you edit the BULLETPROOF .47.8 >>>>>>> SECURE .HTACCESS text above
    # you will see error messages on the BPS Security Status page
    # BPS is reading the version number in the htaccess file to validate checks
    # If you would like to change what is displayed above you
    # will need to edit the BPS /includes/functions.php file to match your changes
    # If you update your WordPress Permalinks the code between BEGIN WordPress and# END WordPress is replaced by WP htaccess code.
    # This removes all of the BPS security code and replaces it with just the default WP htaccess code
    # To restore this file use BPS Restore or activate BulletProof Mode for your Root folder again.
    
    # Start CloudFlare:highratedhosting.com rewrite. Do not Edit
      RewriteEngine On
      RewriteCond %{HTTP_HOST} ^highratedhosting.com
      RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    # End CloudFlare rewrite.
    
    # BEGIN WordPress# IMPORTANT!!! DO NOT DELETE!!! - B E G I N WordPress above or E N D WordPress - text in this file
    # They are reference points for WP, BPS and other plugins to write to this htaccess file.
    # IMPORTANT!!! DO NOT DELETE!!! - BPSQSE BPS QUERY STRING EXPLOITS - text
    # BPS needs to find the - BPSQSE - text string in this file to validate that your security filters exist
    #1545
    Damion
    Member

    adding the code where you told me doesnt solve the issue as my site still crashes.  I am not using the plugin I am just activating it from my bluehost account and cloudflare adds the code to the end of my htaccess file.  When moving it to the suggested place it still doesnt fix it. 

    #1547
    Damion
    Member

    Bluehost said that they have seen this before and that I have to choose one or the other and although I do not think this is true I do think that something in the htaccess file that cloudflare adds is causing the issue.

    #1561
    AITpro Admin
    Keymaster

    I did not realize at first that your site is NOT the Host site –

    highratedhosting.com

    Well since typically HTTP_HOST means your actual website as the Host and not some other website then what must be occuring with that code is that there is some kind of Proxy setup or something else that where your site is no longer seen as the Host and some other site is now the Host.  How they are doing this exactly would be up to them.  So yes it is very possible that there is some kind of conflict and that what they are telling you is true, but I am not a CloudFlare expert and have no idea what the host is doing in their Server configurations to get this htaccess code to work.

    Does CloudFlare work when you ONLY have the CloudFlare htaccess code and NOT BPS htaccess code in your Root .htaccess file?

    #1563
    AITpro Admin
    Keymaster

    Oh wait a minute your site is that site.  Well all that htaccess code is doing is rewriting a non-www url to a www url so your Host is doing something else at the Server level.  The htaccess code must just be placeholder code for them to see if you want CloudFlare or not and is not doing anything else.

    #1564
    AITpro Admin
    Keymaster

    I guess you could try something like this below, but I think what is really happening is that the way BlueHost has chosen to implement CloudFlare is the issue.  In the past other folks have contacted me about CloudFlare issues, but they were all resolved successfully so maybe this is something new that CloudFlare is doing, but more likely it is going to be the way BlueHost is implementing the CloudFlare service itself.

    Anyway give this a try below and if it does not work then I guess you are stuck with what BlueHost is saying – choose one or the other.  Find this code in your Root .htaccess file….

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    and change it to this…

    # Start CloudFlare:highratedhosting.com rewrite. Do not Edit
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^highratedhosting.com
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]
    # End CloudFlare rewrite
    #1566
    AITpro Admin
    Keymaster

    And it looks like if you are using W3TC then the htaccess Page Caching code does not work either if you use BlueHost CloudFlare so this is another indication that you cannot use some types of htaccess code if you want to use the BlueHost CloudFlare service.

    #1567
    Damion
    Member

    tried that and got a 500 error.  will just ask bluehost tech support and if I do not get a good answer I guess I will use bulletproof and scrap cloudflare are I would rather have a secure site than a faster site.

    #1569
    AITpro Admin
    Keymaster

    After searching around the Internet all the clues I found unfortunately point to something like BlueHost is either selectively ignoring htaccess code or in some cases completely restricting/blocking htaccess code that they don’t allow with their free CloudFlare service.  What is interesting to note though is that the W3TC plugin actually includes CloudFlare and CDN features so it is obviously not a direct issue with CloudFlare from the clues I am finding and must have something to do with the specific way that BlueHost is implementing the CloudFlare service.  I will keep looking around to find a definitive answer.

    #6716
    AITpro Admin
    Keymaster

    I ran into another type of problem with Go Daddy Web Accelerator.  Basically I cannot use that since I am doing some fairly advanced stuff – API Server, Secure Download Area, etc etc etc.

    This .htaccess caching code works pretty darn well for speed.  http://forum.ait-pro.com/forums/topic/where-is-the-log/page/2/#post-7436

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.