Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting

WordPress Index of Error: Causes and How to Fix It

WordPress Index of Error: Causes and How to Fix It

Short answer

The WordPress Index of error shows a list of files instead of your site because the server cannot find or use index.php. Common causes are a missing index.php file, WordPress uploaded to the wrong folder, a missing DirectoryIndex rule, or a domain pointing to the wrong folder.

Key takeaways

  • Index of / appears when the server shows a folder instead of index.php.
  • Check that index.php exists in your site's root folder first.
  • Files extracted into a /wordpress/ subfolder are a common cause.
  • DirectoryIndex index.php in .htaccess tells Apache which file to load.
  • Add Options -Indexes to stop visitors browsing your uploads folder.

What is the WordPress “Index of” error?

The Index of / error is a plain page listing files and folders that appears instead of your WordPress site, because the web server could not find or use an index file and showed the folder contents instead.

Web servers look for a default file when someone visits a folder, such as your homepage. For WordPress, that file is index.php.

If the server cannot find that file, or is not told to use it, and directory listing is switched on, it shows a list of whatever is in the folder. The page title reads Index of / followed by the folder path.

You may see it on the homepage, or only in folders like /wp-content/uploads/. The causes and fixes differ, so this guide covers both.

What causes the Index of error in WordPress?

The usual causes are a missing or misnamed index.php file, WordPress files uploaded to the wrong folder, a server not set to load index.php first, or a domain pointing to the wrong folder or server.

CauseWhere you see itQuick check
index.php missingHomepageLook in the site's root folder
Files in wrong folderHomepage shows a folder nameLook for a /wordpress/ subfolder
DirectoryIndex missing index.phpHomepageCheck .htaccess or server config
Domain points to wrong rootHomepage, often a new siteCheck document root and DNS
Directory listing enabled/wp-content/uploads/ and other foldersVisit the folder URL
Malware cleanup removed filesHomepage, after a hackCompare with fresh WordPress files

Work through the checks below in order. The first two cover most cases.

Is the index.php file missing from your site?

If the root folder has no index.php, the server cannot load WordPress, so check the folder in your file manager and restore the file from a backup or a fresh copy of WordPress.

  1. Log in to your hosting file manager or connect with FTP.
  2. Open the folder your domain uses, often public_html.
  3. Look for index.php, wp-config.php, and the wp-admin, wp-content and wp-includes folders.
  4. If index.php is missing, restore it.

The core index.php file is tiny. It loads wp-blog-header.php, which starts WordPress. You can take a clean copy from the WordPress package on the WordPress download page that matches your version.

Never copy wp-config.php or wp-content from a fresh package over your live site. Those hold your settings, themes, plugins and uploads.

Files can go missing after a failed upload, an interrupted migration, or a security scan that quarantined a file it thought was infected. If a hack may be involved, see our guide on running a WordPress security audit.

Are your WordPress files in the wrong folder?

If the listing shows a folder such as wordpress or site, the files were uploaded one level too deep, so move them into the document root or change the root to point at that folder.

This often happens when someone uploads the WordPress zip and extracts it. The archive creates a wordpress folder, so the files end up at public_html/wordpress/ instead of public_html/.

You have two choices:

  • Move the files: move everything inside the subfolder up into the root folder, then delete the empty subfolder.
  • Change the document root: in your hosting panel, point the domain to the subfolder instead.

After moving files, check Settings > General. The WordPress Address and Site Address must match the URL visitors use. If you cannot log in, you can set them in wp-config.php with the WP_HOME and WP_SITEURL constants, as described in the wp-config.php documentation.

Is the server set to load index.php?

The server needs a rule telling it to use index.php as the default file, and if that rule is missing or only lists index.html, you get a directory listing instead of your site.

On Apache and LiteSpeed servers, the rule is called DirectoryIndex. You can add it to the .htaccess file in your site's root folder:

DirectoryIndex index.php index.html

The Apache documentation for mod_dir and DirectoryIndex explains how the server picks a default file.

On Nginx, the equivalent is the index directive in the server block, which your host usually manages:

index index.php index.html;

Back up .htaccess before editing it. A typo can cause a 500 error. Our explainer on what .htaccess does in WordPress covers safe editing.

If you are on managed hosting and cannot edit server settings, ask support to confirm that index.php is set as a default file.

Is your domain pointing to the right place?

If your domain points to a different server or folder than the one holding WordPress, visitors see whatever is there, which may be an empty folder listing, so check your DNS and the domain's document root.

This is common right after:

  • Buying new hosting while DNS still points to the old host.
  • Adding a domain to a hosting account as an addon domain with its own empty folder.
  • Moving a site to a new server.

Check the document root for the domain in your hosting panel and confirm that WordPress is in that exact folder.

Then check DNS. Our guide on pointing a domain to WordPress hosting shows how to confirm the A record and nameservers.

DNS changes can take a while to spread. Test with a different network or a DNS lookup tool before assuming the fix did not work.

Why do you see Index of on the uploads folder?

Seeing Index of /wp-content/uploads/ means your site works but directory listing is switched on, which lets anyone browse your files, so turn it off with Options -Indexes or your host's setting.

This is not a broken site, but it is a privacy and security problem. Visitors and bots can see every file you have uploaded, including ones you never linked.

On Apache or LiteSpeed, add this line to the .htaccess file in your site's root folder:

Options -Indexes

The mod_autoindex documentation describes how directory listings are generated on Apache.

On Nginx, listings are controlled by the autoindex directive. It is off by default, as the Nginx autoindex module docs note, so ask your host if you see listings.

Some hosts also have a Directory Privacy or Indexes setting in cPanel. Many security plugins can add the rule for you. Our guide on hardening WordPress on shared hosting covers this and other quick wins.

Can file permissions cause the Index of error?

Rarely, but if the server cannot read index.php because of wrong permissions or ownership, it may skip the file, so make sure files are set to 644 and folders to 755 in most setups.

Permission problems more often cause 403 Forbidden errors than directory listings. Still, it is worth checking if index.php exists and nothing else explains the problem.

Our guide on setting correct file permissions has the standard values and how to change them safely.

How do you fix the Index of error step by step?

Check for index.php, move misplaced files, add a DirectoryIndex rule, confirm the domain's folder and DNS, and turn off directory listing, testing your site after each step.

  1. Make a backup of files and database if you can.
  2. Confirm index.php exists in the document root. Restore it if not.
  3. Look for a nested wordpress folder and move files up.
  4. Add DirectoryIndex index.php index.html to .htaccess.
  5. Check the domain's document root and DNS records.
  6. Add Options -Indexes to block listings.
  7. Clear any cache or CDN, then test in a private window.

If none of this works, your host can see server logs and configuration you cannot. Send them the URL, what you see, and what you have already tried.

If you need to start over from a known good copy, our guide on restoring WordPress from a backup walks you through it.

How do you prevent the Index of error?

Keep directory listing turned off, upload WordPress to the right folder from the start, keep regular backups, and test your site after migrations or security cleanups.

A few habits help:

  • Add Options -Indexes on every new site.
  • After a migration, check the homepage and a few folders before switching DNS.
  • Review what a security scanner quarantines before deleting files.
  • Keep backups that include all core files, not only wp-content.

These small checks stop most directory listing problems before visitors ever see them.

Frequently asked questions

Why does my WordPress site show Index of instead of the homepage?

The server could not find or load index.php in the folder your domain uses, so it listed the folder contents instead. Check that index.php exists, that WordPress is not inside a subfolder, and that the domain points to the right folder.

Is the Index of page a security risk?

Yes, when it appears for folders like uploads. It lets anyone browse and download your files, including ones you never linked. Turn off directory listing with Options -Indexes in .htaccess or ask your host to disable it.

How do I disable directory browsing in WordPress?

On Apache or LiteSpeed hosting, add the line Options -Indexes to the .htaccess file in your site's root folder. On Nginx, ask your host to make sure autoindex is off. Many security plugins can also add this rule for you.

Can I restore a missing index.php file?

Yes. Download WordPress for the same version you run and copy only the index.php file from the root of the package into your site's root folder. Do not overwrite wp-config.php or the wp-content folder.

Why did index.php disappear from my site?

Common reasons are an interrupted upload or migration, a manual deletion, or a security scanner quarantining the file after it was infected. If malware may be involved, scan the whole site before restoring files.

Sources

  1. Apache mod_dir (DirectoryIndex) Apache HTTP Server Project
  2. Apache mod_autoindex Apache HTTP Server Project
  3. Module ngx_http_autoindex_module nginx.org
  4. Download WordPress WordPress.org

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.