WP Super Cache – WP Super Cache htaccess code, Custom Code

Home Forums BulletProof Security Free WP Super Cache – WP Super Cache htaccess code, Custom Code

Viewing 15 posts - 1 through 15 (of 83 total)
  • Author
    Posts
  • #2454
    Donald Krebs
    Member

    I just spent several hours troubleshooting an issue that blanked out our site this morning.
    think I caused the problem by selecting an option in BulletProof that caused it to conflict with another plug-in, WP Super Cache. In troubleshooting this WP site, I deactivated all the plug-ins possible including BulletProof. 
    We are back up now, I have re-activated all the plug-ins except BulletProof. I would like to examine the log before I reactivate BP, I am afraid if I just reactivate then the settings (wrong, probably) will cause the problem all over again.
    I assume if I look over the log and don’t see what might have caused the problem, then un-installing and re-installing BP is in order, right?
    Or, what would you guide me to do next?
    dk

    #2455
    AITpro Admin
    Keymaster

    No, actually BPS has built-in troubleshooting so deactivating and deleting BPS is not the correct way to troubleshoot issues/problems.

    Please see the BulletProof Security Read Me First Forum Topic for the correct way to troubleshoot issues/problems:  http://forum.ait-pro.com/forums/topic/read-me-first-free/

    The Security Log file is located here:  /wp-content/bps-backup/logs/http_error_log.txt

    When you install BPS nothing happens at that point.  When you activate BulletProof Modes that is when something happens.

    To quickly reverse a site crash you can delete the root .htaccess file via FTP to get back into your site.  I assume you are using mod_rewrite in WP Super Cache so you will need to “roll your own” and create a combined Master .htaccess file using the BPS Custom Code feature.  Basically you would copy the entire WP Super Cache .htaccess code to the top Custom Code text box, save your changes and activate root folder BulletProof Mode again.  Your root .htaccess file will contain both the BPS htacces code and the WP Super Cache htaccess code.

    #2459
    Donald Krebs
    Member

    based on your reply I can reactivate BPS and build a working htaccess file. I will let you know…

    #2463
    Donald Krebs
    Member

    per your instruction I re-activated BPS and went to page for custom .htaccess. Pasted from WPSuperCache. Then I went to Security Modes page and activated BulletProof Mode in topmost panel. When I went to the site I got a server error. I then re-named the .htaccess file (that clue you gave earlier is handy as a pocket on a shirt) and now the site is back.
    Below it the .htaccess file after custom modification:

    #2465
    AITpro Admin
    Keymaster

    Right after your WP Super Cache code I saw this block of htaccess code.  I think this is the problem.  BPS already incorporates the standard WordPress Rewrite .htaccess code so there is no need to add this again.  this code is probably being autogenerated by WP Super Cache.
    [deleted]

    #2469
    Donald Krebs
    Member

    I removed the code you found, I still get a 500 Internal Server Error. Also, I don’t find any code in the .htaccess that offers options, to # out.

    #2470
    Donald Krebs
    Member

    BTW, I’ve requested the lady with the checkbook to buy pro. It should happen in the next few days.

    #2471
    AITpro Admin
    Keymaster

    Ok then that means you have a typo or invalid code somewhere.  I noticed something strange and maybe you added this to the code you posted?

    Did you add this to the code?  “.htaccess ASCII text”

    Compare the working WP Super Cache code I posted above against the code you have and see if there are differences in the code.  If you see ASCII anywhere then that is not valid.  I have no idea where that would be coming from.

    #2474
    Donald Krebs
    Member

    I don’t know where it came from. I just did a search on the current code and it’s not there now.

    #2475
    AITpro Admin
    Keymaster

    Nope that is not coming from BPS so if that non-valid text is in your WP Super Cache code then your site will definitely crash with a 500 error.  😉

    #2476
    AITpro Admin
    Keymaster

    You should ONLY be using the htaccess code that is generated and shown to you by WP Super Cache from within the WP Super Cache plugin page.  You would then copy that htaccess code to BPS Custom Code.  Do not do this outside of WP Super Cache or BPS.  The entire process needs to be done from within your WordPress Dashboard and from within both plugin settings pages.

    #2486
    Donald Krebs
    Member

    The site is working now with both WPSuperCache and BulletProofSecurity plug-ins activated.
    Based on you last post I:

    returned to Dashboard
    first inactivated WPSuperCache,
    then went to cPanel of HostGator and deleted htaccess and other htaccess files like …OLD and …-BAK, in order to start fresh.
    I then went to BPS and created a generic .htaccess file.
    Then I activated WPSuperCache and copied the mod rewrite rules from # BEGIN WPSuperCache to# END WPSuperCache.
    I then went to BPS custom code and pasted the WPSC into the top section and saved the custom code.
    Returning to the BPS top page, I activated the BulletProofMode.

    The site displays properly.
    I suppose after all this, the topic line should be changed.

    #2491
    AITpro Admin
    Keymaster

    Great!  and yep I changed the Topic on the last round of “back and forth”.  😉  Thanks for adding your exact steps and also confirming that all is well.

    #2715
    AITpro Admin
    Keymaster

    UPDATE: BPS Pro 13+ and BPS 2.0+ versions have a feature called: Setup Wizard AutoFix (AutoWhitelist|AutoSetup|AutoCleanup) that automatically creates plugin and theme whitelist rules and automatically sets up and cleans up caching plugins htaccess code.

    BPS Pro: WP Super Cache installation and/or setup steps.

    1.  Turn Off AutoRestore.
    2.  Go to F-Lock and unlock your wp-config.php file.  Do not unlock your root .htaccess file.  The reason for this is that WP Super Cache will write its htaccess code to the bottom of the root .htaccess file and it should be at the top of the root htaccess.
    3.  Install the WP Super Cache plugin if it is not already installed.  Go to the WP Super Cache Settings page and choose your settings.

    I found that these settings worked the best in benchmarking tests on Go Daddy.
    Checked/selected – Use mod_rewrite to serve cache files. (Recommended)
    Checked/selected – Compress pages so they’re served more quickly to visitors. (Recommended)
    Unchecked/unselected – Mobile device support. (External plugin or theme required. See the FAQ for further details.)

    4.  Click the Update Status button to save your settings.
    5.  Copy the WP Super Cache .htaccess mod_rewrite code.
    6.  Go to BPS Custom Code and paste the WP Super Cache .htaccess code into the top text box:  CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE and click the Save Root Custom Code button.  If you have a php/php.ini handler in your Root .htaccess file then copy that php/php.ini handler right above the WP Super Cache .htaccess code.  See example .htaccess file above as a reference.
    7.  Go to the BPS Security Modes page and click the Root Folder BulletProof Mode Activate button.
    8.  Go to F-Lock and lock your wp-config.php file.
    9.  Go to AutoRestore and click Root Files Backup Files button, click the wp-content Files Backup Files button and turn AutoRestore back On.

    UPDATE: Garbage Collection should also be setup On the WP Super Cache Advanced page
    Expiry Time & Garbage Collection
    Cache Timeout:  set to 3600 seconds which is 1 hour
    Scheduler:  chose Timer and set to 3600 seconds
    Notification Emails:  chose not to have emails sent to me when the garbage collection runs.

    The WP Super Cache setup is complete.

    ______________________________________________
    BPS Free: WP Super Cache installation and/or setup steps
    1.  Deactivate the WP Super Cache plugin.
    2.  Go to the htaccess Core page > htaccess File Editor tab page > click the Turn Off AutoLock button and click the Unlock htacces File button. Note: Your wp-config.php file permissions need to be 644. BPS Free does not lock the wp-config.php file, but other WP Security plugins do do that. Check and make sure your wp-config.php file permissions are 644.
    3.  Activate the WP Super Cache plugin. You can use the WP Super Cache setting choices in the BPS Pro setup steps above or choose your own WPSC settings.
    4. Copy your WPSC htaccess code from your root htaccess file to BPS Custom Code and paste the WP Super Cache .htaccess code into the top Custom Code text box: CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE:
    5. Click the Save Root Custom Code button.
    6. Go to the BPS Security Modes page and click the Root Folder BulletProof Mode Activate button.
    7. Go to the htaccess Core page > htaccess File Editor tab page > click the Turn On AutoLock button and click the Lock htacces File button.

    #2718
    Antoin Vink
    Participant

    Great setup!

    I will install these setup tonight on my Website.
    Thank you for the E-mail by the way!
    And this code:

    Header unset ETag
    FileETag None
    
    # BEGIN Browser Cache
    # 1 YEAR
    
    <FilesMatch "\.(ico|pdf|flv)$">
    Header set Cache-Control "max-age=29030400, public"
    ExpiresDefault "access plus 1 years"
    </FilesMatch>
    
    # 2 MONTHS
    <FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
    Header set Cache-Control "max-age=4838400, public"
    ExpiresDefault "access plus 2 months"
    </FilesMatch>
    
    # 1 WEEK
    <FilesMatch "\.(txt|css|js)$">
    Header set Cache-Control "max-age=604800, public"
    ExpiresDefault "access plus 1 weeks"
    </FilesMatch>
    
    # 30 MIN
    <FilesMatch "\.(html|htm|php)$">
    Header set Cache-Control "max-age=1800, private, proxy-revalidate"
    ExpiresDefault "access plus 30 minutes"
    </FilesMatch>
    
    # END Browser Cache
Viewing 15 posts - 1 through 15 (of 83 total)
  • You must be logged in to reply to this topic.