-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
588a514
commit 8e3650b
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# WP Rocket | Remove ETag | ||
|
||
Prevents ETag code to be added to htaccess. | ||
|
||
Documentation: | ||
* [Divi Theme](https://docs.wp-rocket.me/article/657-divi-theme) | ||
|
||
To be used with: | ||
* any setup where ETags should be removed, for example with the Divi theme if font icons are missing in IE 11 | ||
|
||
Last tested with: | ||
* WP Rocket 2.11.x | ||
* WordPress 4.9.x |
58 changes: 58 additions & 0 deletions
58
htaccess/wp-rocket-htaccess-remove-etag/wp-rocket-htaccess-remove-etag.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Plugin Name: WP Rocket | Remove ETag | ||
* Description: Prevents ETag code to be added to htaccess. | ||
* Plugin URI: https://github.com/wp-media/wp-rocket-helpers/tree/master/htaccess/wp-rocket-htaccess-remove-etag/ | ||
* Author: WP Rocket Support Team | ||
* Author URI: http://wp-rocket.me/ | ||
* License: GNU General Public License v2 or later | ||
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
* | ||
* Copyright SAS WP MEDIA 2018 | ||
*/ | ||
|
||
// Namespaces must be declared before any other declaration. | ||
namespace WP_Rocket\Helpers\htaccess\remove_etag; | ||
|
||
// Standard plugin security, keep this line in place. | ||
defined( 'ABSPATH' ) or die(); | ||
|
||
/** | ||
* Prevents ETag code to be added to htaccess. | ||
*/ | ||
add_filter ( 'rocket_htaccess_etag', '__return_false'); | ||
|
||
/** | ||
* Updates .htaccess, regenerates WP Rocket config file. | ||
* | ||
* @author Caspar Hübinger | ||
*/ | ||
function flush_wp_rocket() { | ||
|
||
if ( ! function_exists( 'flush_rocket_htaccess' ) | ||
|| ! function_exists( 'rocket_generate_config_file' ) ) { | ||
return false; | ||
} | ||
|
||
// Update WP Rocket .htaccess rules. | ||
flush_rocket_htaccess(); | ||
|
||
// Regenerate WP Rocket config file. | ||
rocket_generate_config_file(); | ||
} | ||
register_activation_hook( __FILE__, __NAMESPACE__ . '\flush_wp_rocket' ); | ||
|
||
/** | ||
* Removes customizations, updates .htaccess, regenerates config file. | ||
* | ||
* @author Caspar Hübinger | ||
*/ | ||
function deactivate() { | ||
|
||
// Remove all functionality added above. | ||
remove_filter ( 'rocket_htaccess_etag', '__return_false'); | ||
|
||
// Flush .htaccess rules, and regenerate WP Rocket config file. | ||
flush_wp_rocket(); | ||
} | ||
register_deactivation_hook( __FILE__, __NAMESPACE__ . '\deactivate' ); |
Binary file added
BIN
+1.59 KB
htaccess/wp-rocket-htaccess-remove-etag/wp-rocket-htaccess-remove-etag.zip
Binary file not shown.