• Resolved Ambyomoron

    (@josiah-s-carberry)


    I am a little confused about how this plugin works. I am using ver. 1.9.44 of the plugin with WP 5.8 and Apache 2.4.

    My understanding is that the plugin basically gives you a way to determine the directives to put in .htaccess (when using Apache) and the update of .htaccess has to be done manually.

    However, I find that when the plugin is active and the various settings have been configured and the CLI command has been run, the response headers are indeed sent, exactly as configured in the plugin, even though there are no directives in .htaccess, which is completely unexpected.

    Let me clarify the situation. I add the directives to .htaccess, clear all caches, and test the site (using either Chrome or https://viewhttpheaders.com) to see what headers are being sent. All is well. Then I remove the directives from .htaccess, clear the caches and retest. The headers are still there! Then I deactivate the plugin and retest. Now only the default WP headers are there, not what I configured in the plugin. Re-activate the plugin, but do not put the directives in .htaccess and the headers, as configured in the plugin, are once again being sent.

    I am quite sure that there are no other .htaccess files lurking with any of the relevant directives. And there are no other plugins or functions in functions.php that send these headers.

    So, have I completely misunderstood how the plugin is working, or is some other strange thing is happening?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Kevin Pirnie

    (@kevp75)

    Hi there. No, it does not “require” any server-side configuration.

    The plugin sets the headers with the PHP functions.

    I put the notes and integration in there, in case there is indeed something in the hosting that blocks PHP from being able to set headers. (I actually ran into that situation with an older hosting company that I did some work for)

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    Thanks for this clarification. I misread the text, thinking that the plugin would try to automatically copy code to .htaccess.

    Plugin Author Kevin Pirnie

    (@kevp75)

    No problem @josiah-s-carberry ??

    Right before I released the plugin I tried that… automatically writing the config to .htaccess, but ended up finding a host that didn’t allow that either, in addition to other issues where, if a site had something like iThemes Security installed, both plugins were trying to write to the file at the same time, and breaking the site.

    I’m going to be working on it over the next couple of weeks… there are some things I want to re-word, plus I want to test it under PHP 8, and see if anything breaks ??

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    If you are planning to work more on the plugin, you might also consider adding the cache-control header. Ideally, one should be able to set max-age differently according to the file type. For example, highly static files might have a very long max-age, whereas files apt to change might have a much shorter max-age, or no caching at all.

    Plugin Author Kevin Pirnie

    (@kevp75)

    I wouldn’t put anything caching related in here, keeping it strictly about the security based headers.

    Thanks for the suggestion though. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Does the plugin require update to .htaccess?’ is closed to new replies.