Resolve redirection to index_gzip.html issue
In some cases your visitors can be redirected to this kind of URL on your site:
There could be three reasons for this related to WP Rocket.
Redirect from HTTP to HTTPS
If you have SSL enabled for your entire site, you will need to make sure that all links pointing to the HTTP version of your site will be automatically redirected to the HTTPS version
Note: If you are running v2.5.5 of WP Rocket or older, make sure to check Fix For SSL Redirection Issue Knowledge Base article. Maybe better idea would be to update WP Rocket to the latest version
This problem can appear when your site is accessible via both addresses
To resolve it, follow our Fixing non-www Redirection Knowledge Base article.
Remove rewrite rules from .htaccess
Another potential issue could be related to Rewrite Rules we add in .htaccess file. To remove this, make a custom MU plugin as follows:
Note: Also read the general instructions in this article: How to Make a Custom (MU) Plugin
Create a folder named mu-plugins in your wp-content folder.
In case a mu-plugins folder already exists, don’t create a new one, just use the existing one.
- Using a basic text editor create a new file and put the following code in it:
<?php defined( 'ABSPATH' ) or die( 'Cheatin’ uh?' ); /** * Plugin Name: WP Rocket | Remove Rewrite Rules * Description: Removes Rewrite Rules block of WP Rocket from .htaccess. * Author: WP Rocket Support Team * Author URI: http://wp-rocket.me/ * License: GNU General Public License v3 or later * License URI: http://www.gnu.org/licenses/gpl-3.0.html */ // Removing Rewrite Rules block of WP Rocket from .htaccess. add_filter('rocket_htaccess_mod_rewrite', '__return_false');
- Save the file as wp-rocket-remove-rewrite.php (you can name it however you want, in fact)
- Upload this file to the mu-plugins folder created in step 1.
- Finally, make sure to deactivate and re-activate WP Rocket.
When you have uploaded the MU plugin and reloaded your page in the browser, the weird redirection should be gone.