Setting up a redirect for the main page

Several ways to set up competent redirection
Prove that it is a copy first

Do not redirect a page merely because its name contains index or home

Compare its content with the home page and inspect the response code. A legitimate page with a different purpose must remain available.

  • confirm matching content;
  • create a backup;
  • the rule must detect an external request, not the CMS's internal routing.
Comparing pages, creating a backup and applying a precise rule only to a confirmed duplicate
Redirect the identical copy and leave a legitimate different page unchanged.

Ready-to-send message for the developer or host

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.

Safe sequence

  1. Check the code and compare the page visually with home.
  2. Back up configuration and files.
  3. Add one precise rule before internal CMS rules.
  4. Test home, internal pages, forms and administration.

Technical notes

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.

Nginx

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.

After the repair

  • check the duplicate and final home page;
  • test internal pages and forms;
  • confirm that there is no loop;
  • verify the result manually;
  • restore the backup immediately if anything fails.