LiteSpeed Cache plugin – add htaccess code to BPS Custom Code

Home Forums BulletProof Security Pro LiteSpeed Cache plugin – add htaccess code to BPS Custom Code

This topic contains 8 replies, has 2 voices, and was last updated by  Josh 6 months, 2 weeks ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #34250

    Josh
    Participant

    The LiteSpeed Caching plugin added the following to the top of the root .htaccess file. The BPS Pro install stripped it out.

    I just want to make sure I’m placing the code back in the proper place. Here’s the code:

    # BEGIN LSCACHE
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    <IfModule LiteSpeed>
    RewriteEngine on
    CacheLookup on
    RewriteRule .* - [E=Cache-Control:no-autoflush]
    RewriteRule min/\w+\.(css|js) - [E=cache-control:no-vary]
    
    ### marker CACHE RESOURCE start ###
    RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
    ### marker CACHE RESOURCE end ###
    
    ### marker FAVICON start ###
    RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
    ### marker FAVICON end ###
    
    </IfModule>
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    # END LSCACHE

    Does this code go in the very “top box” within the BPS Pro > Custom Code > Root Access File Custom Code ?
    Then to make changes take… goto BPS Pro > Security Modes > Root Folder BulletProof Mode (RBM) and click Deactivate and then Activate.

    Thanks,
    Josh

    #34251

    AITpro Admin
    Keymaster

    You would add the LiteSpeed Cache plugin htaccess code in this BPS Root Custom Code text box:  1. CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE, click the Save Root Custom Code button and activate Root Folder BulletProof Mode.

    #34254

    Josh
    Participant

    Right on. So if “Root Folder BulletProof Mode” is already activated before placing and saving the code in “Root Access File Custom Code” , then we DO need to deactivate and then activate for the changes to take effect, correct?

    In think I ran into the same situation when I was placing the Author Enumeration code. I saved the code then immediately tested a URL and it was still passing me the username. Only after going back and “deactivating” and then “activating” RFBM did the changes take effect.

    Thanks,

    Josh

    #34255

    AITpro Admin
    Keymaster

    Think of BPS Custom Code as an option setting because that is what it literally is.  So when you save anything to BPS Custom Code option settings then those option settings are saved to your WP Database.  When you activate Root BulletProof Mode any Custom Code option settings from your WP Database are applied/written to your root htaccess file.  Deactivating Root BulletProof Mode creates a default generic WP root htaccess file, but you can edit your default.htaccess file directly using the BPS htaccess File Editor and any changes you make to the default.htaccess file will be saved permanently.  Example:  Let’s say your particular web host uses php handler htaccess code and you want to save that php handler code in the default.htaccess file so that if you deactivate Root BulletProof Mode your host’s php handler code will exist in the default BPS root htaccess file that is loaded/copied when you deactivate Root BulletProof Mode.  And yeah the default.htaccess file functionality/capability was also very well thought out. 😉

    #34271

    Josh
    Participant

    Sorry for the late reply.

    I’m not really following. I assumed the root .htaccess file wasn’t a file saved in the database. I didn’t know WordPress saved it’s files in the database as well.

    I find the part in your directions about going and clicking on “Activate” to be a bit confusing. When BPS Pro is installed, all of these things are already “Activated”.

    So when I’m reading directions that say “Go to the Security Modes page and click the Root folder BulletProof Mode Activate button.”… yet this shows a status of currently “Activated”, imo, seems counter intuitive to click on “Activate” when I can clearly see it already activated.

    So now I’m to understand that although the “Root Folder Bullet Proof Mode” RBM status says Activated, I still need to click on the Activate button?

    Thanks for the explanation about http-handler code, but I have no idea about this stuff, so it doesn’t really make much sense to me right now, unfortunately.

    Thanks,

    Josh

    #34273

    AITpro Admin
    Keymaster

    It’s a “wording” thing.  A long time ago we decided to use the words “Activate” and “Deactivate”, which in hindsight was not the best choice of words, but we are kind of stuck with them now since changing that wording would most likely cause massive confusion for folks.  Activate means On and Deactivate means Off.  We used to tell folks to “reactivate” Root folder BulletProof Mode, but stopped using that term/wording a couple of years ago because that caused some confusion for folks.

    Ok so the base BPS root htaccess file is a static file, which you can think of as a template.  BPS Custom Code is a plugin option setting that you add data into and save it.  Each/anytime you click the Root BulletProof Mode Activate button what occurs is that any/all Custom Code that is saved in your WordPress database will then be written into the BPS root htaccess file.  Basically you are “reactivating” Root BulletProof Mode, which updates the BPS root htaccess file with any current changes that you have made in BPS Custom Code.

    Ok I’ll try to make the steps clearer for you on how and where to add your LiteSpeed Cache plugin htaccess code.

    1. You would add (copy and paste) your LiteSpeed Cache plugin htaccess code into this BPS Root Custom Code text box: CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE
    2. Click the Save Root Custom Code button.
    3. Go to the Security Modes page and click the Root Folder BulletProof Mode Activate button, which will then add/write your newly saved LiteSpeed Cache plugin htaccess code that you saved in BPS Custom Code to your BPS root htaccess file.

    #34274

    Josh
    Participant

    Thanks for addressing and the explanation on the “Activation/Activate” confusion I had. Makes sense now except one tiny thing.

     “Each/anytime you click the Root BulletProof Mode Activate button what occurs is that any/all Custom Code that is saved in your WordPress database will then be written into the BPS root htaccess file.” 

    I know you mean well, but this wording in your doc’s had confused me a bit. Now I’m tracking. When you say BPS root .htaccess file, you’re actually referring to WordPress’s root .htaccess file that BPS edits and takes over/replaces when BPS Pro is installed and running. (Hopefully I’m not far off on that assumption.)

    In the beginning when I first installed BPS Pro, I was thinking there were two different files because of the wording being used. (And I’m fairly new to working with WordPress, which probably doesn’t help.) One file for BPS and one file for WordPress. Especially when the root .htaccess file was quarantined and then suddenly referred to as “auto_.htaccess”. This made absolutely no sense. (I’ve never seen a file name auto_.htaccess before… what’s this.) But I see what’s going on now.

    After looking at your steps to add code, I was doing that part correctly. It was the last step that I was doing incorrectly. Now I fully understand the steps and the “WHY” behind them. Thanks for the clarification..

    Josh

    #34276

    AITpro Admin
    Keymaster

    Yep, you got it.  The only additional info I would add is that the BPS root htaccess file is not actually a WordPress default htaccess file.  WordPress default Rewrite htaccess code is included/incorporated into the BPS root htaccess file.  The BPS root htaccess must be created as a “master” htaccess file and not as stand-alone htaccess code blocks, otherwise BPS security code/rules would not work at URI|URL levels deeper than the root URI|URL.  The root URI|URI is your WordPress installation folder.  Deeper URI|URL rewriting levels would be /level1/level2/level3/.

    If the .htaccess file was not renamed to something other than .htaccess then wherever that .htaccess was copied to would use/apply the rules in that .htaccess file.  By renaming the .htaccess file to auto_.htaccess the file becomes just another plugin file instead of a server configuration file since the server looks for .htaccess files/code rules to apply to your server.  The file naming convention could be anything such as:  bak.htaccess, old.htaccess, etc.

    #34283

    Josh
    Participant

    Ahhhhh… The light bulb is slowly coming on now. 🙂 🙂 🙂

    Ok… So BPS basically takes over .htaccess duties and others. I see now.

    Hahahahahaha… and now I get why .htaccess is renamed to something other than the original name. My newb ignorance is laughable at times. I’m learning though and that’s what I really appreciate. Thanks.

    Josh

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.