WordPress htaccess: redirect index.html to index.php

If you need to make the redirection from index.html to index.php the best way to do this on the server-side not the client one. This solution is better as firstly it is real quick and easy like, and secondly you don’t need to keep in mind about this change in future while making any changes on client-side.

How to redirect index.html to index.php in WordPress?

The best working rule is the following one:

Add these three lines to your htaccess file that is in the root folder of your site. To get it use FTP or in-build file manager of your hostinger.

RewriteEngine On

RewriteBase /

RewriteRule ^index\.html?$ / [NC,R,L]

This rule change only file with the name ‘index’ and has three additional flags: NC,R,L. Here the explanation of these flags in htaccess: NC (case insensitive); R (temporary redirect to new URL); L (last – stop processing rules). If you want to know what other flags can be used go to this link: htaccess flags.

If you have some other better modification for redirection to index.php from index.html feel free to leave it in comments.

Leave a Reply

Your email address will not be published. Required fields are marked *