Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk9 min

How to Set a Different Default Index File in Apache

Set Apache’s default directory page with DirectoryIndex. This guide covers configuration scope, .htaccess permissions, fallback files, inherited lists, redirects, trailing slashes, and missing-index behavior.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Apache’s DirectoryIndex directive to change the file served when someone requests a directory URL such as https://example.com/. For example, DirectoryIndex home.html makes Apache look for home.html before serving the directory’s default resource. The directive is handled by mod_dir and can be set globally, in a virtual host, for a directory, or in .htaccess when the server permits the required override.

You can specify one filename or an ordered fallback list such as DirectoryIndex index.php index.html. Apache checks the names from left to right and serves the first resource that exists. The browser normally keeps the directory URL; use DirectoryIndexRedirect only when you deliberately want an HTTP redirect to the selected file.

As an Amazon Associate I earn from qualifying purchases.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Apache’s default index setting does

A request for a directory is different from a request for a specific file. When a client asks for / or for a path ending in /, Apache’s mod_dir module evaluates the directory’s index list. The documented default list contains index.html. DirectoryIndex changes that list.

The value is a local URL relative to the directory being requested. If the request is for /docs/ and the configuration says DirectoryIndex home.html, Apache looks for /docs/home.html, not for a file named /home.html at the site root. A value may also identify a path below that directory, for example DirectoryIndex pages/welcome.html.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Index selection happens only after Apache has normalized the directory request to its slash form. A request for /docs is normally redirected to /docs/ by DirectorySlash; then DirectoryIndex is evaluated for /docs/.

Choose the configuration scope

Put the directive in the narrowest scope that matches your goal. A server-wide setting affects every applicable directory unless a more specific configuration changes the inherited list.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Scope Where it applies Typical use Important condition
Server configuration All virtual hosts and directories covered by the server configuration One site-wide convention, such as a standard entry file Requires administrator access and a configuration reload or restart according to your deployment process
Virtual-host configuration One named site or virtual host Different defaults for separate domains on the same Apache instance Requires access to that virtual host’s configuration
Directory section A specific filesystem directory and its configured descendants Set a default for an application or content tree Requires access to the server configuration
.htaccess The directory containing the file and, subject to normal inheritance, its descendants Change behavior without editing the main Apache configuration The server must allow the Indexes override for that directory

Hosting control panels may generate Apache configuration for you, but their labels and file locations are not universal. The directive and its permitted context are the stable part of the configuration.

Set one different index file

To make home.html the directory entry file, add this directive in the chosen scope:

DirectoryIndex home.html

Place the directive in the virtual-host or server configuration when you administer Apache directly. For a directory-specific change, put it in that directory’s configuration section. For a per-directory change, create or edit the .htaccess file in the directory that should use the new default:

DirectoryIndex home.html

With a request for /, Apache checks for /home.html. With a request for /products/, the same directive in /products/.htaccess checks for /products/home.html. The filename is not a filesystem absolute path; it is a URL relative to the requested directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Apply the change in the right place

  1. Identify the directory URL whose default should change, such as /, /docs/, or /app/.
  2. Confirm that the target file exists in that directory, using the exact spelling and case used by the URL.
  3. Choose server, virtual-host, directory, or .htaccess scope according to the table above.
  4. Add DirectoryIndex home.html to that scope.
  5. If you edited the main server or virtual-host configuration, perform the configuration validation and reload procedure used by your Apache installation. If you edited .htaccess, Apache reads the change with requests when overrides are enabled.
  6. Request the directory with a trailing slash and verify that the intended file is returned while the address remains the directory URL.

Use an ordered fallback list

You can provide several candidates on one directive. Apache tests them from left to right and serves the first resource it finds:

DirectoryIndex index.php index.html

For a directory containing both files, index.php wins. If index.php is absent, Apache tries index.html. This is useful during migrations, when a dynamic entry point should take precedence but a static fallback must remain available.

A list can include a path relative to the requested directory:

DirectoryIndex app/start.php welcome.html

For /site/, Apache checks /site/app/start.php, then /site/welcome.html. Keep the order intentional: putting a generic static file first can prevent a later application entry point from ever being selected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Single file versus fallback list

Configuration Result when the first file exists Result when it is missing
DirectoryIndex home.html home.html is selected Apache proceeds according to any other inherited index entries or, if none match, the directory’s no-index behavior
DirectoryIndex index.php index.html index.php is selected Apache checks index.html
DirectoryIndex disabled No index candidate is configured by that directive Used as a reset control only when it is the sole argument

Replace inherited entries instead of appending

Repeated DirectoryIndex directives add entries to the existing list. This matters when a parent directory, server configuration, or virtual host already defines index.html. Adding:

DirectoryIndex home.html

does not necessarily remove the inherited entry; it appends another candidate. To replace the inherited list, reset it first and then define the new list:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
DirectoryIndex disabled
DirectoryIndex home.html

Here, disabled is a control value only when it is the sole argument on its directive. If you write DirectoryIndex disabled home.html, Apache treats disabled as a literal resource name rather than as the reset instruction.

Reset and define a fallback list

To discard inherited entries and establish your own order, use two directives:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
DirectoryIndex disabled
DirectoryIndex home.html index.html

Apache now checks only home.html and then index.html in that order for the applicable directory. Use this form when an inherited application entry point must not be selected.

Make .htaccess work safely

DirectoryIndex is valid in .htaccess, but Apache classifies the directive under the Indexes override class. The server configuration must therefore allow Indexes for the directory. If the applicable AllowOverride policy disables that class, Apache will reject or ignore the attempted per-directory setting according to the server’s error handling, and the file will not change the index behavior.

When you control the main configuration, the reliable alternatives are to place the directive in the virtual-host or directory section, or to change the applicable override policy so that Indexes is permitted. On managed hosting where you cannot change that policy, ask the administrator to add the directive in the site’s Apache configuration.

Correct location for a subdirectory

Suppose the site has /var/www/site/docs/ and you want only https://example.com/docs/ to open welcome.html. Put this in /var/www/site/docs/.htaccess:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
DirectoryIndex welcome.html

The setting is local to /docs/. It does not change the root directory’s default unless the file is placed in the root scope or inherited through a broader configuration.

Understand what users see in the browser

By default, Apache selects the index internally. A request for / can be served by /home.html while the browser continues to display /. This is internal directory index handling, not an external redirect.

DirectoryIndexRedirect changes that behavior. When enabled, Apache sends a redirect to the selected index resource instead of serving it transparently. The documented modes include temporary, permanent, seeother, and explicit 3xx status codes. Use a redirect only when exposing the file URL is part of your URL design; otherwise leave the normal internal selection in place.

Behavior Address shown after the request When it is appropriate
Normal DirectoryIndex The directory URL, such as /docs/ Most sites; keeps the entry filename as an implementation detail
DirectoryIndexRedirect The selected file URL, such as /docs/home.html When clients must receive an explicit redirect and the file URL is canonical for your design

Trailing slash normalization

DirectorySlash normally redirects a directory URL without a trailing slash to the slash form. For example, /docs becomes /docs/, after which DirectoryIndex is evaluated. The Apache documentation warns that disabling this normalization can expose directory contents in some configurations where mod_autoindex is active. Leave the default enabled unless you have a specific, tested reason to change it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What happens when no index file exists

If none of the configured resources exists, Apache does not automatically invent an index page. A directory listing can be generated only when the Indexes option is enabled. Listing generation is handled by the separate mod_autoindex module.

  • If a candidate file exists, Apache serves the first matching candidate in the configured order.
  • If no candidate exists and directory indexing is disabled, the request does not become a listing; the server returns its configured no-index response, commonly an error.
  • If no candidate exists and Indexes is enabled, mod_autoindex may generate a listing of the directory.

Do not enable directory listings merely to hide a missing index file. A listing can reveal filenames and directory structure. Create the intended index resource or disable listing unless public browsing is a deliberate feature.

Diagnose a default-index change that appears not to work

Symptom Likely cause What to check
The old file still opens An inherited DirectoryIndex entry remains ahead of the new one Reset with DirectoryIndex disabled on its own line, then define the desired order
Apache reports that the directive is not allowed in .htaccess The directory does not permit the Indexes override Move the directive to server, virtual-host, or directory configuration, or have the administrator allow Indexes
A different directory changes unexpectedly The directive was placed in a parent scope or server-wide scope Move it to the intended directory’s configuration or .htaccess
The file works at the root but not in a subdirectory The filename is being resolved relative to the requested directory Place the file in that subdirectory or specify a relative path such as pages/home.html
A directory listing appears No configured index matched and Indexes is enabled Create one of the listed resources or disable directory indexing
The browser URL changes to the filename DirectoryIndexRedirect is enabled Remove or adjust that directive if transparent serving is desired
/docs and /docs/ behave differently The slash-normalization redirect is involved Test the trailing-slash URL and keep DirectorySlash enabled unless a documented requirement says otherwise

Test the result without confusing cache or URL behavior

  1. Test the exact directory URL with a trailing slash, for example / or /docs/.
  2. Confirm that the selected file exists in the directory represented by that URL.
  3. If a fallback list is configured, temporarily account for which earlier files are present; the first existing candidate always wins.
  4. Test the no-file case only in a safe environment by moving or renaming candidates, then restore them. Observe whether the result is an error or an auto-generated listing, depending on the Indexes option.
  5. Test the slashless form separately if URL normalization matters. A redirect to the slash form is expected with the normal DirectorySlash setting.
  6. If you enabled DirectoryIndexRedirect, inspect the response as a redirect rather than expecting the directory URL to remain visible.

When several configuration layers are involved, inspect each applicable server, virtual-host, directory, and .htaccess setting. Remember that repeated directives append entries unless you explicitly reset the inherited list.

Practical configuration patterns

Static site with a new landing page

DirectoryIndex home.html

Use this when one known static file should represent the directory and no earlier inherited candidate should take precedence. If an inherited list exists, prepend the reset form shown earlier.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Application first, static fallback second

DirectoryIndex index.php index.html

This checks the application entry point first and uses the static page only when the application file is absent.

Subdirectory with its own entry path

DirectoryIndex app/start.php

For a request to /portal/, Apache checks /portal/app/start.php. Keep the target inside the requested directory tree and verify that the relative URL matches the deployed layout.

Strict replacement of a parent configuration

DirectoryIndex disabled
DirectoryIndex welcome.html fallback.html

This discards inherited candidates for the applicable scope, then checks welcome.html followed by fallback.html.

Key decisions before you deploy

  • Scope: choose global, virtual-host, directory, or .htaccess based on how broadly the rule should apply.
  • Order: put the preferred resource first; Apache stops at the first existing match.
  • Inheritance: use the sole-argument disabled control value before your new list when inherited entries must be removed.
  • Relative path: resolve each value from the requested directory, not from the filesystem root.
  • Override policy: permit the Indexes override before relying on .htaccess.
  • URL policy: leave normal internal serving in place unless you intentionally need DirectoryIndexRedirect.
  • No-match behavior: decide whether a missing index should produce an error or a public listing, and treat listings as an explicit exposure choice.

The essential change is therefore small: set DirectoryIndex in the correct scope, verify the file’s location and ordering, and account for inherited entries and no-match behavior. Apache’s documented default is index.html, but the directive lets each applicable directory use a different resource without changing the URL structure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.