Title: .htaccess file overwritten
Last modified: November 20, 2019

---

# .htaccess file overwritten

 *  Resolved [Hot Themes](https://wordpress.org/support/users/hotwptemplates/)
 * (@hotwptemplates)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/htaccess-file-overwritten/)
 * Hello,
 * I want to report a bug in this plugin, version 3.0.13. If website contains a .
   htaccess file with some data (in example 301 redirections) and try to enable 
   GZIP compression under Cache, if this message appears:
 * `We successfully added Gzip compression settings into .htaccess file. However,
   the test file we fetched was not Gzip-compressed. It seems one of Apache modules-
   mod_filter or mod_deflate - is not active.`
 * the user’s custom .htaccess would be overwritten.
 * Luckily, I had a backup of my .htaccess file, but I think you should fix this.
 * Thanks,
    Milos

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/htaccess-file-overwritten/#post-12154374)
 * Hi Milos,
 * When the relevant section does not exist in the .htaccess, WP-Optimize will add
   its settings **at the end** of the file, and not override them.
 * If the section already exists and some parameters changed, it will replace the
   contents between the comments:
 * # BEGIN WP-Optimize Browser Cache
    … # END WP-Optimize Browser Cache
 * I have tested again to make sure, and for me, only the changes between WP-Optimize
   tags are overridden when saving the relevant settings.
 * Here are screenshots of my tests:
 * [⌊Screen-Shot-2019-11-20-at-11-40-59⌉⌊Screen-Shot-2019-11-20-at-11-40-59⌉[
 * [⌊Screen-Shot-2019-11-20-at-11-41-39⌉⌊Screen-Shot-2019-11-20-at-11-41-39⌉[
 * So you might have something else overriding?
 * Marc.
    -  This reply was modified 6 years, 6 months ago by [Marc Lacroix](https://wordpress.org/support/users/marcusig/).
 *  Thread Starter [Hot Themes](https://wordpress.org/support/users/hotwptemplates/)
 * (@hotwptemplates)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/htaccess-file-overwritten/#post-12154391)
 * But what if somebody is using this plugin for the first time and doesn’t have
   these comments in .htaccess file, and, at the same time has some custom code 
   in .htaccess file, in example 301 redirects? Could you test this please?
 *  [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/htaccess-file-overwritten/#post-12154411)
 * This is what the screenshots above show:
 * It first contains the default WordPress settings, plus some custom 301 redirects,
   which I manually added.
 * Then I enabled browser caching, and the section was _added_ after the 301 redirects
   which I had previously manually edited.
 * I tested this several times on different configurations.
 *  [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/htaccess-file-overwritten/#post-12154422)
 * Could you maybe share the list of plugins that are enabled on your site, to see
   if any of them could be causing this?
 *  Thread Starter [Hot Themes](https://wordpress.org/support/users/hotwptemplates/)
 * (@hotwptemplates)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/htaccess-file-overwritten/#post-12154423)
 * In your case, is the GZIP compression enabled successfully or you got the same
   message as I did? Maybe it doesn’t work correctly only if the GZIP compression
   enabled is not enabled successfully.
 *  [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/htaccess-file-overwritten/#post-12155657)
 * Yes it was enabled successfully.
 * But the fact of editing the .htaccess happens the same way, wether the compression
   works or not: it uses the same method to write in the file.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘.htaccess file overwritten’ is closed to new replies.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/htaccess-file-overwritten/#post-12155657)
 * Status: resolved