All code in .htaccess file is replaced with S2Member GZIP code


I had to deactivate the plugin because it has deleted every line of code - including WordPress default code - in my .htaccess file and replaced it with “# BEGIN s2Member GZIP exclusions…”.

This line of code would make most of my site pages populate a 404. When my host would change the code, the plugin would change it back.

EDIT: This only happened after the most recent update (Version 210208).

If you need any more information on this please let me know!

Best regards,


Not sure if this got overlooked or things are just extremely busy but my s2Member pro plugin is no longer usable. If I could get some sort of help I would greatly appreciate it!

Hi Josh.

Sorry I missed your post before.

The behavior you’re describing is very strange. I haven’t seen it before. Nothing in this update (or any of the previous ones in over 2 years) has touched the part of the plugin activation procedure that adds the .htaccess rules.

I did several tests just now, and can confirm that s2 only adds its rules to the file, it doesn’t throw away what was there. And it adds them on installation, not on an update. If you’ve done updates in the past, this was also true and you didn’t have this problem then.

I honestly don’t know what could have happened this time for you. I reviewed s2 code for this and it does several checks to make sure things are okay before trying to add it. I will study that code closer to see if I can imagine a scenario that causes what you experienced, try to reproduce it, and then find how to avoid it in the future.

Do you have a backup of your .htaccess before this that you could put back in the live site? Have you made a backup of the site recently, or does your hosting have a backup?

That missing part that is causing the 404s, is most likely WordPress’:

If you don’t have a backup of the .htaccess file, you can try adding those lines to your current one, right after the s2Member block. E.g.

# BEGIN s2Member GZIP exclusions
<IfModule rewrite_module>
	RewriteEngine On
	RewriteBase /
	RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
	RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
	RewriteRule .* - [E=no-gzip:1]
# END s2Member GZIP exclusions

# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
  • You’d just need to change the rewrite base if it’s not the root folder.

I hope that helps! Let me know how it goes. I look forward to your update.


Hi Cristian,

Would the issue be in any way related to the All In One WP Security plugin changing the WordPress DB Table Prefix?

Best regards,


Hi Josh.

Hmm… I don’t think so, but honestly I can’t say for sure.

I know that that is a popular plugin. Many use it together with s2 and haven’t reported this issue.

Hi Cristian,

So I placed the s2Member GZIP exclusions code above the default WP code then I reactivated both of the s2Member plugins, cleared my browser’s and site’s cache, and, so far, everything works fine.

I wonder what the deal was? It may forever be an unsolved mystery - AKA Cold Case Files.

Best regards,


1 Like

I’m very glad that sorted it out! :smiley:

Thank you for the update. :slight_smile: