Apache
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+index\.php(?:[?\s]) [NC]
RewriteRule ^index\.php$ https://example.com/ [R=301,L]Place it before requests are sent to the front controller.
Compare its content with the home page and inspect the response code. A legitimate page with a different purpose must remain available.

Hello, A copy of the home page is available at /index.php on example.com. Please configure a permanent 301 or 308 redirect to https://example.com/. It must apply only to an external /index.php request and must not interfere with internal CMS routing. Back up the configuration and test the site afterwards.
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+index\.php(?:[?\s]) [NC]
RewriteRule ^index\.php$ https://example.com/ [R=301,L]Place it before requests are sent to the front controller.
location = /index.php {
if ($request_uri ~ "^/index\.php(?:\?|$)") {
return 301 https://example.com/;
}
# Keep the working PHP configuration.
}Do not replace the entire existing PHP block with this fragment.