Skip to content
Databases & DevelopmentAdvanced

How to Enable Microsoft IndexNow on a PHP Website for Faster SEO Discovery

Quick Answer You can enable Microsoft IndexNow on a custom PHP website by generating an IndexNow API key, uploading a publicly accessible text file containin...

BI
Bison Technical Team Enterprise IT specialists
Updated 18 Oct 2026 15 min read 1 total views
Structured technical guidanceSafety notes included where requiredSources listed below

Quick Answer

You can enable Microsoft IndexNow on a custom PHP website by generating an IndexNow API key, uploading a publicly accessible text file containing that key to your website's root directory, and submitting newly published, updated, or deleted page URLs to the IndexNow API. You can automate this process in PHP whenever your website publishes or updates content.

Important: IndexNow does not create an XML sitemap or make an existing sitemap live. Your sitemap must be generated and accessible separately. Use both IndexNow and an XML sitemap: the sitemap helps search engines discover your site's URL inventory, while IndexNow notifies participating search engines about specific content changes. Neither method guarantees indexing or search rankings.

Advertisement

1. What Is Microsoft IndexNow?

IndexNow is a protocol that allows website owners to notify participating search engines when URLs are added, updated, or deleted. Microsoft Bing supports IndexNow, and submitted URLs may be shared with other participating search engines through the protocol.

Without IndexNow, search engines may discover new or updated pages when they revisit your website, follow links, or process your sitemap. IndexNow provides an additional notification mechanism that can help them discover changes sooner.

IndexNow is particularly useful for custom PHP websites, news websites, knowledgebases, product catalogs, blogs, and other sites where content changes frequently.

2. Understand the Difference Between IndexNow and an XML Sitemap

Feature IndexNow XML Sitemap
Primary purpose Notify search engines about URL changes Provide a list of URLs intended for crawling
Typical use New, updated, or deleted pages Maintaining a discoverable inventory of important canonical URLs
Can be automated with PHP? Yes Yes
Creates the other automatically? No No
Guarantees indexing? No No

For a custom PHP website, maintain a valid XML sitemap, publish its location in your robots.txt file, submit it through Bing Webmaster Tools, and use IndexNow to notify search engines when individual pages change.

3. Prerequisites

Before implementing IndexNow, ensure that you have:

  • A working PHP website accessible through its public domain.
  • HTTPS configured correctly, if HTTPS is the canonical version of your site.
  • Access to the website's document root through your hosting control panel, FTP, SFTP, or another authorized file-management method.
  • A way to identify published page URLs, such as a PHP database, content management system, or publishing workflow.
  • An XML sitemap that returns valid XML, or the ability to create one.
  • Access to Bing Webmaster Tools to manage your website and check submission information.

If your website uses a content management system or a hosting platform that already supports IndexNow, check its existing integration before writing custom PHP code.

4. Generate an IndexNow API Key

IndexNow uses a key to verify that URL notifications are authorized for your website. The key is not a replacement for your hosting password or a secret that should be exposed unnecessarily in application logs or public source code.

  1. Generate an IndexNow key using the official Bing IndexNow setup page or generate a compliant key yourself.
  2. Use a key consisting of 8–128 characters from the permitted set of letters, digits, and hyphens. For a self-generated key, use a cryptographically secure random generator.
  3. Create a UTF-8 text file named exactly as the key followed by .txt.
  4. Place the file in the root directory of the public website, where search engines can retrieve it without logging in.
  5. Put the exact key in the file contents. Do not include explanatory text or additional values.

For example, if your generated key is YOUR-GENERATED-KEY, the file should be named YOUR-GENERATED-KEY.txt and its contents should be exactly YOUR-GENERATED-KEY.

Security note: The key file is intentionally public because participating search engines need to verify it. Do not use a password, database credential, hosting password, or another sensitive application secret as your IndexNow key.

5. Upload and Verify the Key File

Suppose your website's canonical domain is https://www.example.com. Upload the key file to the document root that serves this domain.

For example, the file may be located on the server at a path such as /public_html/YOUR-GENERATED-KEY.txt, depending on your hosting configuration.

Open the corresponding public URL in a browser:

https://www.example.com/YOUR-GENERATED-KEY.txt

Replace the example domain and key with your actual values. A successful check displays the key as plain text and does not return a 403 Forbidden, 404 Not Found, or server error.

Check the following if the file cannot be accessed:

  • Confirm that the file is in the correct document root for the chosen hostname.
  • Check the exact filename, including capitalization where the server is case-sensitive.
  • Ensure that your web server or .htaccess rules do not block access to the text file.
  • Check that the website does not redirect the file to an unrelated hostname or login page.
  • Confirm that the file contents match the key exactly.

Use the canonical hostname consistently. For example, if your site uses https://www.example.com, submit URLs using that hostname rather than mixing it with https://example.com unless both host variants are deliberately configured and verified as appropriate.

6. Submit a Single URL to IndexNow

Once the key file is accessible, you can notify IndexNow about an individual URL. The official global endpoint is:

https://api.indexnow.org/indexnow

For a simple test, submit a URL belonging to your own website that has recently been published or updated. The request must include the full page URL and the key.

Example PHP code using cURL:

<?php

$host = 'www.example.com';
$key = 'YOUR-GENERATED-KEY';
$pageUrl = 'https://www.example.com/example-page.php';

if (
    parse_url($pageUrl, PHP_URL_SCHEME) !== 'https' ||
    strtolower((string) parse_url($pageUrl, PHP_URL_HOST)) !== $host
) {
    throw new RuntimeException('The page URL does not match the configured HTTPS host.');
}

$endpoint = 'https://api.indexnow.org/indexnow?' . http_build_query(
    [
        'url' => $pageUrl,
        'key' => $key
    ],
    '',
    '&',
    PHP_QUERY_RFC3986
);

$ch = curl_init($endpoint);

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CONNECTTIMEOUT => 10,
    CURLOPT_TIMEOUT => 20
]);

$response = curl_exec($ch);
$curlError = curl_error($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

if ($response === false) {
    throw new RuntimeException('IndexNow request failed: ' . $curlError);
}

if ($statusCode === 200 || $statusCode === 202) {
    echo 'IndexNow accepted the submission request. HTTP ' . $statusCode;
} else {
    echo 'IndexNow returned HTTP ' . $statusCode;
}

?>

Requirements: Run this example on the PHP server, not in a browser. The PHP cURL extension must be enabled, and the server must be able to make outbound HTTPS requests. Replace the example domain, key, and page URL with your actual values before running it.

The example deliberately checks that the submitted page uses HTTPS and the configured hostname. In a production implementation, validate URLs against a trusted canonical hostname and approved site paths before submitting them. Do not accept arbitrary URLs from untrusted user input.

The API response indicates whether the notification was accepted at the protocol level. It does not prove that the page has been crawled or indexed.

7. Submit Multiple URLs in One Request

If your PHP website publishes several pages at once, you can send a batch of URLs using a JSON POST request. IndexNow supports up to 10,000 URLs in a single POST request, subject to valid formatting and applicable service limits.

Example PHP implementation:

<?php

$host = 'www.example.com';
$key = 'YOUR-GENERATED-KEY';

$urls = [
    'https://www.example.com/page-one.php',
    'https://www.example.com/page-two.php'
];

foreach ($urls as $url) {
    if (
        parse_url($url, PHP_URL_SCHEME) !== 'https' ||
        strtolower((string) parse_url($url, PHP_URL_HOST)) !== $host
    ) {
        throw new RuntimeException('Invalid URL for the configured host: ' . $url);
    }
}

$payload = [
    'host' => $host,
    'key' => $key,
    'urlList' => array_values(array_unique($urls))
];

$ch = curl_init('https://api.indexnow.org/indexnow');

curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($payload, JSON_THROW_ON_ERROR),
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json; charset=utf-8'
    ],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CONNECTTIMEOUT => 10,
    CURLOPT_TIMEOUT => 30
]);

$response = curl_exec($ch);
$curlError = curl_error($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

if ($response === false) {
    throw new RuntimeException('IndexNow request failed: ' . $curlError);
}

if ($statusCode === 200 || $statusCode === 202) {
    echo 'IndexNow accepted the batch submission. HTTP ' . $statusCode;
} else {
    echo 'IndexNow returned HTTP ' . $statusCode;
}

?>

This example demonstrates the basic batch request. A production implementation should also validate the key format, remove duplicate URLs, limit batch sizes, handle HTTP errors, and record submission results without logging the key or sensitive data. The key file must remain accessible to the search engines.

If your key file is not at the website root, consult the official documentation for the additional keyLocation parameter and the URL scope permitted by that file location.

8. Automate IndexNow in Your PHP Publishing Workflow

Automation is usually the most useful approach for a custom PHP website. Rather than manually submitting URLs after each update, integrate IndexNow into the workflow that publishes, updates, or deletes content.

For example, if a website stores articles in a database, the publishing workflow might be:

  1. An administrator creates or edits an article.
  2. The application saves the article and confirms that it is published.
  3. The application constructs the canonical public URL from the trusted article identifier or slug.
  4. The application queues the URL for IndexNow submission.
  5. A background worker or scheduled PHP task submits the URL to the IndexNow endpoint.
  6. The application records the result and retries temporary failures according to a controlled retry policy.

Submit URLs only after the relevant database transaction has succeeded. If a page changes from draft to published, notify IndexNow after the page is publicly accessible. When a published page is deleted, notify IndexNow about its removal as appropriate.

Recommended implementation practices

  • Use canonical public URLs rather than internal database URLs or preview links.
  • Submit only URLs belonging to the verified website and permitted URL scope.
  • Notify search engines when a meaningful page change occurs, rather than on every page view.
  • Keep a submission queue if API failures must not interrupt the publishing process.
  • Use controlled retries for network failures, timeouts, and HTTP 429 responses.
  • Do not expose the API key unnecessarily in frontend JavaScript, public logs, or error messages.
  • Do not submit private, login-only, test, staging, or unintended duplicate URLs.

Where a PHP application has a large number of pages, submit changed URLs in batches instead of repeatedly sending one request for every page. Do not submit your entire URL inventory repeatedly as a substitute for maintaining a sitemap.

9. Keep Your XML Sitemap Live

IndexNow does not replace your XML sitemap. A custom PHP website can provide a static sitemap file or generate one dynamically from the database. The correct approach depends on how often your published content changes.

Option A: Static XML sitemap

For a small website with infrequent changes, you can maintain a file such as sitemap.xml in the public document root. It should contain valid XML and the canonical URLs of pages that should be discovered and considered for indexing.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>https://www.example.com/</loc>
    </url>
    <url>
        <loc>https://www.example.com/about.php</loc>
    </url>
</urlset>

Replace the example URLs with actual canonical pages on your website. Do not include example URLs in a production sitemap.

Option B: Dynamically generated PHP sitemap

If your website stores articles in a database, a PHP endpoint can generate the sitemap from published records. The implementation should:

  • Include only public pages that you want search engines to discover.
  • Exclude drafts, deleted records, internal search results, and private pages.
  • Output valid XML and set an appropriate XML content type.
  • Escape XML values correctly, especially URLs containing special characters.
  • Use canonical absolute URLs and avoid duplicate URL variants.
  • Return an appropriate HTTP error if the sitemap cannot be generated, rather than returning a misleading empty or invalid sitemap.

If your application uses a route such as sitemap.php, its public URL may be https://www.example.com/sitemap.php. You do not have to rename it to sitemap.xml if the existing endpoint serves valid sitemap XML. A conventional XML filename is often easier to recognize and manage, but correct content and accessibility matter more than the filename.

Check the sitemap in a browser

Open the actual sitemap URL, for example:

https://www.example.com/sitemap.xml

Confirm that the request succeeds, the response contains XML rather than an HTML error page, and the URLs are correct. Check the sitemap after publishing new pages to ensure the sitemap generator reflects the latest database state.

Reference the sitemap in robots.txt

Add a sitemap declaration to the public robots.txt file, using the actual sitemap URL:

Sitemap: https://www.example.com/sitemap.xml

If the sitemap is served from sitemap.php, use that real URL instead. A sitemap declaration helps search engines locate the sitemap but does not override crawling restrictions or guarantee indexing.

10. Submit the Sitemap to Bing Webmaster Tools

After confirming that your sitemap is accessible, use Bing Webmaster Tools to manage your website and submit its sitemap.

  1. Sign in to Bing Webmaster Tools.
  2. Add your website if it has not already been added.
  3. Verify ownership using one of the supported verification methods.
  4. Open the sitemap submission area.
  5. Submit the full public sitemap URL.
  6. Check the sitemap processing status and investigate any reported errors.

You can also use the Bing webmaster portal to inspect available URL inspection, crawling, and indexing information for your website. The exact interface and available reporting features may change over time.

Submitting a sitemap is different from submitting URLs through IndexNow. Use both methods when appropriate so the search engine has a complete sitemap and timely notifications of content changes.

11. Verify That IndexNow Is Working

Use the following checklist after setup:

Check Expected result If it fails
Public key file The file URL displays the exact key as plain text. Check the filename, document root, access rules, and contents.
PHP request The PHP script reaches the API and receives an HTTP response. Check the cURL extension, outbound HTTPS connectivity, TLS configuration, and timeout.
API response HTTP 200 indicates successful protocol-level acceptance; HTTP 202 indicates acceptance with key validation pending. Investigate the returned status code and follow the official troubleshooting guidance.
XML sitemap The sitemap loads and contains the intended canonical URLs. Check XML syntax, PHP errors, database queries, and URL generation.
Bing Webmaster Tools The site and sitemap can be managed, and available reports can be reviewed. Check site verification, sitemap status, crawling restrictions, and reported errors.
Search results The page may appear after crawling and indexing. Check indexability, HTTP status, canonical URL, robots directives, content quality, and crawl reports.

An HTTP 200 response means that the URL submission was accepted by the protocol. It does not confirm that the search engine has crawled the page, indexed it, or displayed it in search results. Similarly, an HTTP 202 response means that the notification was accepted while key validation is pending.

12. Common IndexNow Problems and Solutions

HTTP 400 – Bad Request

The request may contain invalid parameters or an incorrectly formatted payload. Check the request method, JSON structure, required fields, URL encoding, and key format.

HTTP 403 – Forbidden

The key may be invalid, the key file may be missing, or the file contents may not match the submitted key. Verify the key file's public URL and exact contents.

HTTP 422 – Unprocessable Entity

The submitted URLs may not belong to the specified host, the key may not meet the protocol requirements, or the request may otherwise fail validation. Check the hostname, scheme, key, and URL list.

HTTP 429 – Too Many Requests

The service may be rate-limiting submissions. Reduce the request frequency, respect applicable limits, and retry later using a controlled backoff strategy.

The key file returns 403 or 404

Check that the file is in the document root for the correct hostname. Review web-server rules, access restrictions, file permissions, and case-sensitive filenames. If a CDN or security service is in use, confirm that it allows public access to the file.

Submitted URLs do not appear in search results

IndexNow is a notification protocol, not an indexing guarantee. Confirm that the page is publicly accessible, returns the expected HTTP status, is not blocked from crawling, and has an appropriate canonical URL. Review available search-engine diagnostics and allow time for crawling and indexing.

13. Should You Submit Every URL in Your Sitemap to IndexNow?

For normal ongoing operation, submit URLs when pages are newly published, meaningfully updated, or deleted. Continue maintaining the sitemap as the comprehensive inventory of your site's intended crawlable URLs.

If you have just introduced IndexNow to an existing website, you generally do not need to submit every historical URL. Prioritize pages that have changed since integration. A one-time bulk submission may be appropriate after a substantial site migration or redesign, but it should not replace ongoing sitemap maintenance.

14. Frequently Asked Questions

Does IndexNow automatically create a sitemap?

No. IndexNow notifies participating search engines about URL changes. You must create and maintain your XML sitemap separately.

Does enabling IndexNow guarantee that Bing will index my pages?

No. It helps Bing and other participating search engines discover URL changes, but crawling, indexing, ranking, and search-result appearance are determined separately.

Can I enable IndexNow on a custom PHP website without WordPress?

Yes. A custom PHP application can create the key file and submit URL notifications using cURL or another HTTP client. You do not need WordPress or an SEO plugin.

Can I submit a PHP page such as article.php?id=123?

Yes, if the URL is a valid public URL on your verified host. However, submit the canonical URL that you want search engines to discover, and avoid unnecessary duplicate parameter variants.

Can I submit deleted URLs?

Yes. IndexNow supports notifications for deleted URLs as well as added and updated URLs. Make sure the URL genuinely corresponds to the changed or deleted content.

Should I submit my homepage every time an article is published?

Usually, submit the article URL that changed. Submit the homepage separately only when it has itself changed meaningfully.

Can I use IndexNow for Google indexing?

IndexNow is supported by participating search engines, including Bing. Do not assume that submitting to IndexNow directly submits URLs to Google. Maintain your sitemap and use the appropriate tools supported by each search engine.

Can I use IndexNow without Bing Webmaster Tools?

Manual IndexNow submissions can be implemented using the protocol and a valid key file. However, Bing Webmaster Tools is useful for site management, sitemap submission, and available crawling or indexing diagnostics.

How many URLs can I submit at once?

The protocol permits up to 10,000 URLs per JSON POST request. Keep batches within the limit and comply with applicable rate limits and request validation rules.

Will a sitemap automatically notify search engines whenever it changes?

Not necessarily. Maintaining a sitemap makes URL discovery easier, but you should not assume that a sitemap change triggers an immediate crawl. Use IndexNow notifications for relevant URL changes and submit your sitemap through the search-engine tools that support it.

Conclusion

To enable Microsoft IndexNow on a custom PHP website, create a compliant API key, publish the matching text file in a publicly accessible location, and submit changed page URLs through the IndexNow API. Automate notifications within the publishing workflow for reliable ongoing operation.

For a complete SEO discovery setup, keep your XML sitemap valid and current, reference it in robots.txt, submit it through Bing Webmaster Tools, and verify that your pages are accessible and eligible for crawling. IndexNow improves change notifications; it does not guarantee indexing or replace the sitemap.

Sources

YOUR FEEDBACK

Was this guide useful?

Your answer helps us keep BISONKB accurate and practical.

Links are permitted only to published BISONKB articles.
THE BISON BRIEF

Practical IT knowledge, once a week.

New troubleshooting guides, scripts and infrastructure notes. No noise.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.