Skip to content
FunnelGuard

Fix guide by FunnelsGuard

index.html and index.php duplicate URLs: how to find and fix

SEO-057Low impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

Web servers show a default file when someone asks for a folder. Ask for /pricing/ and the server may quietly serve /pricing/index.html or /pricing/index.php. That is normal. The problem starts when the file name itself also works as a public address, so /pricing/ and /pricing/index.html both return the same page with a 200 (OK) status.

Search engines treat each URL as a separate page. They have to guess which one to show. The home page is the most common case: /, /index.html, /index.php and /home/ can all exist side by side.

One page, several addresses
  1. /pricing/Preferred URL, 200
  2. /pricing/index.htmlSame page, also 200
  3. Links point to bothSignals are split
  4. Search picks oneMay not be yours

The folder URL is the one you want ranked. The index file URLs split links and signals.

Why it costs you leads or sales

The direct harm is small, which is why this is rated low impact. Google is usually good at merging obvious duplicates. Still, you can lose in a few ways:

What duplicates can cost you
  • Backlinks and internal links are split between two URLs instead of adding up on one.
  • Search results may show the /index.html version, which looks untidy and may not match your tracking and reporting.
  • Analytics reports list the same page twice, so conversion rates per page are harder to read.
  • Crawl time is spent on copies instead of new pages, which matters more on large sites.
  • Ad landing page URLs and campaign reports can end up on different variants of the same page.

How to check if your site has it

Test your site in a few minutes
  1. Try the index URLs by hand

    Add index.html, index.php and index.htm to your home page and main folder URLs in a browser. If the address stays the same and the page loads, the duplicate exists.

  2. Check the status code

    Run curl -I https://example.com/index.html. A 200 means a duplicate. A 301 to / is the fix working.

  3. Search Google for indexed copies

    Search site:example.com inurl:index.html and site:example.com inurl:index.php. Any result means the duplicate was indexed.

  4. Check Search Console

    In Google Search Console, open Pages (indexing) and look for URLs ending in index.html or index.php under statuses like Duplicate, Google chose different canonical than user.

  5. Crawl your site

    Run a crawler such as Screaming Frog and filter the URL list for index.. Also look for internal links that use these URLs.

Check status codes from the command linebash
curl -sI https://example.com/ | head -n 1
curl -sI https://example.com/index.html | head -n 1
curl -sI https://example.com/index.php | head -n 1
# Fixed: the index URLs return 301 and a Location header pointing to /

How to fix it

Do three things: redirect the index file URLs with a 301, update internal links to the folder URL, and set a canonical on the folder URL as a backup. How you do the redirect depends on your server or platform.

Redirect index file URLs to the folder URL
  1. Apache (.htaccess)

    Add the rule from the snippet below near the top of your .htaccess. It matches only direct requests for the file, not the internal folder lookup, so it avoids a redirect loop.

  2. Nginx

    Add the rewrite rule from the Nginx snippet inside your server block, then run nginx -t and reload.

  3. Test

    Run curl on the index URLs and confirm a 301 to the folder URL, with query strings handled as you intend.

Apache: 301 redirect index.html and index.php to the folder URLhtaccess
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+(.*?/)?index\.(html?|php)[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]
Nginx: 301 redirect index files to the folder URLnginx
location ~ ^(.*/)index\.(html?|php)$ {
    return 301 $1$is_args$args;
}
Then tidy up the signals
  1. Update internal links

    Change menu, footer, button and sitemap links that point to index.html or index.php so they use the folder URL.

  2. Set a canonical

    On each page add a self-referencing canonical in the head that uses the folder URL.

  3. Fix the sitemap

    List only folder URLs in your XML sitemap.

  4. Update ad and campaign URLs

    If any ads or email links use an index URL, switch them to the folder URL. Check that the redirect keeps UTM and click ID parameters.

Self-referencing canonical on the folder URLhtml
<link rel="canonical" href="https://example.com/pricing/" />
Before and after

Duplicates live

  • / and /index.html both return 200
  • Internal links mix both versions
  • Canonical missing or inconsistent
  • Reports list the page twice

One address

  • /index.html returns 301 to /
  • All links use the folder URL
  • Self-referencing canonical on /
  • Reports show one page

How to confirm it's fixed

Confirm the fix
  • curl -I on /index.html, /index.php and /index.htm returns 301 with Location set to the folder URL.
  • The folder URL still returns 200 and the page loads normally.
  • The redirect keeps query strings such as utm_source and gclid.
  • A crawl finds no internal links to index file URLs.
  • The sitemap lists only folder URLs.
  • In Search Console, use URL Inspection on the folder URL and check the user-declared canonical matches.

Old duplicates may stay in search results for a few weeks. The 301 tells Google to consolidate them over time.

How to prevent it happening again

Keep it clean
  • Always link to folder URLs when building menus, buttons and ad destinations.
  • Keep the redirect rule in your server config and in your deployment notes so a migration does not drop it.
  • After a site rebuild or host move, rerun the curl tests.
  • Run a crawl every quarter and filter for index..
  • Keep self-referencing canonicals in your theme or SEO plugin templates.

How FunnelGuard handles this

FunnelGuard does not check for index.html or index.php duplicates today. It is a possible future check, not something you can rely on now.

What FunnelGuard does do is run your real customer journeys on a schedule, such as lead forms, checkouts and booking buttons. It checks each step and the tracking hits sent to ad and analytics platforms, and sends one alert with a screenshot and a likely cause if a journey fails. That helps if a bad redirect on a landing page breaks the journey or strips tracking, but it will not tell you that duplicate index URLs exist.

To watch for this issue, use Google Search Console (Pages report), a quarterly crawl with a tool like Screaming Frog, and the curl checks above after any server or site change. A free read-only website audit from FunnelGuard is also available if you want a general look at your site.

Questions people ask

Is index.html duplicate content bad for SEO?

It is a minor problem. Google often merges the two URLs on its own, but you can split links and reporting between them. A 301 redirect and a canonical remove the doubt cheaply.

How do I redirect index.html to the root domain?

On Apache, add a RewriteRule in .htaccess that matches direct requests for index.html and sends a 301 to the folder URL. On Nginx, use a location block that returns 301 for paths ending in index.html. Test for redirect loops afterwards.

Why is my index.php showing up in Google search results?

Because /index.php returns the same page with a 200 status and was linked or crawled. Google found it as a separate URL. Redirect it to the folder URL, fix internal links and wait for Google to recrawl.

Should I use a canonical or a 301 for index.html?

Use a 301 redirect as the main fix, because it sends both users and crawlers to one URL. Add a self-referencing canonical on the folder URL as a backup signal.

How do I check if /index.html returns the same page as my home page?

Open the URL in a browser, or run curl -I on it. If it returns 200 and shows the same content as the folder URL, it is a duplicate. A 301 to the folder URL means it is handled.

Does a redirect from index.html keep my UTM parameters?

It depends on the rule. Rules that append the query string keep them, and rules that drop it strip them. Test with a URL like /index.html?utm_source=test and check the Location header.

Do Shopify, Wix or Squarespace sites have index.html duplicates?

Usually not, because these platforms do not serve index file paths and return 404 for them. Test the URLs to be sure, and add a redirect only if an indexed copy exists.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.