WP Rocket index-https error

Updated reading time

Causes a domain to redirect to:
https://www.domain.co.uk/wp-content/cache/wp-rocket/domain.co.uk/index-https.html

I recently got an issue with WP Rocket bringing out the URL. And it’s not a good thing at all!

This is in fact Duplicate content and is caused by WP Rocket creating a cached HTML version of your index.php page in the above example.

One thing’s for sure: it is not WP Rocket’s fault at all!

Where to find the root cause of issue

You’ve got to check your htaccess file for this issue.
You will notice that you might’ve been doing a 301 redirect somewhere. Normally, you will have 2 modules: WP Rocket code, and WordPress code. Anything else will be from other plugins or custom code.

You might’ve checked if it’s your hosting provider’s server caching? It likely is not, so let’s set this to ‘Off’, or to ‘Development mode’ if you have any server-side caching or CloudFlare.

Now, open httpstatus.io, and check all instances of http redirects for your domain:

  • domain.co.uk
  • http://domain.co.uk
  • http://www.domain.co.uk
  • https://domain.co.uk
  • https://www.domain.co.uk

This should give you a clue if the error happens on having https. If that’s the case, then we’ll have to check our .htaccess file for rules set for https.

On our htaccess file, you’ll need to comment stuff out and see what happens (be careful though).

For my case, it was a conflict between custom code and WP Rocket! The custom code was removed in favour of WP Rocket’s solution.

This post explains that the root cause is most likely in your htaccess file, rather than your server caching, or through another plugin.

Related:  Why Every Software Developer Needs a Blog

Most likely it would be custom code on your htaccess file! 😄