Updated: 9 November 2026 · Applies to: Apache 2.4 (tested 2.4.69, .htaccess as used on cPanel hosting) and Nginx (tested 1.30.5); browser steps from Google and Microsoft documentation
To make home.html your website’s homepage instead of index.html, add this line to the .htaccess file in your site’s main folder (public_html on cPanel):
DirectoryIndex home.html index.html index.php
Apache then shows home.html when someone opens https://yourdomain.com/. On an Nginx server, use the index directive instead (see below). If you came here to set a website as the start page of your own browser, jump to the last section.
How the homepage file is chosen
When a visitor opens your domain without a file name, the web server looks for an index file in that folder. Apache’s own default is DirectoryIndex index.html; hosting control panels usually add index.php and a few others. A DirectoryIndex line in your .htaccess sets the list for your folder. Apache tries the names from left to right and serves the first file that exists. The address bar keeps showing https://yourdomain.com/, which is the homepage URL search engines index.
Apache and cPanel: set home.html with .htaccess
- Open your site’s main folder. In cPanel, use File Manager and open
public_html. Enable hidden files to see.htaccess; editing .htaccess in the cPanel File Manager shows how. - Edit
.htaccess(create it if it does not exist) and add the line at the top:DirectoryIndex home.html index.html index.php
- Save the file and open your domain in a private browser window. No restart is needed: Apache reads
.htaccesson every request.
We tested this on Apache 2.4.69 with a folder holding both index.html and home.html. Before the change, / returned index.html. After it, our test requests gave (summarised: path, status, file served):
GET / 200 OK home.html GET /blog/ 200 OK blog/index.html GET /index.html 200 OK index.html
Three things the test showed:
- Subfolders inherit the setting. The
.htaccessrule also applies to every folder below it. That is why/blog/still worked: it has nohome.html, so Apache fell back toindex.html. - Keep the fallback names. When we set only
DirectoryIndex home.html,/blog/showed a file listing (“Index of /blog”) instead of a page. If directory listings are switched off, visitors get an error page instead. Always listindex.htmlandindex.phpafter your own file. To hide listings anyway, see how to disable directory browsing. - If home.html is removed, Apache serves
index.htmlagain, so the site never goes blank.
The old index.html stays reachable at /index.html. If it holds an outdated page, delete or rename it so visitors and search engines do not find two homepages.
If .htaccess seems to be ignored, the server does not allow this override: according to Apache, DirectoryIndex in .htaccess needs AllowOverride Indexes (or All). On your own server, enable that or put the same line in the virtual host instead. More .htaccess options are in Options, IndexOptions, DirectoryIndex and ErrorDocument with .htaccess.
Nginx: set home.html with the index directive
Nginx does not read .htaccess files. Set the order in the server block of your site, for example /etc/nginx/conf.d/example.com.conf or a file in /etc/nginx/sites-available/:
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example;
index home.html index.html index.php;
location / {
try_files $uri $uri/ =404;
}
}
Test the configuration, then reload Nginx:
nginx -t
systemctl reload nginx
Output of nginx -t on our test server:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
On Nginx 1.30.5, / then returned home.html, /blog/ fell back to its index.html, and after we deleted home.html the homepage went back to index.html, exactly as on Apache. The default Nginx configuration uses index index.html index.htm;, so you only change that one line.
Redirect instead? Usually not
You could send visitors from / to /home.html with a 301 redirect (RedirectMatch 301 ^/$ /home.html). It works, but the address bar then shows /home.html and search engines treat that as your homepage URL. DirectoryIndex keeps the clean https://yourdomain.com/ address, so it is the better choice. Use redirects for moved pages, for example HTTP to HTTPS with .htaccess.
Set a website as the homepage of your browser
Many people searching “set as homepage” want a site to open when they start their browser. That is a browser setting, not a server one. According to Google, in Chrome on a computer:
- Select More (three dots) > Settings.
- For the page that opens on start: select On startup > Open a specific page or set of pages > Add a new page, enter the web address and select Add.
- For the Home button: under Appearance, turn on Show Home button and enter your custom page.
According to Microsoft, in Microsoft Edge select Settings and more > Settings > Start, home, and new tab page, then under On startup choose Open custom sites and add the address. For Firefox, see Mozilla’s guide to setting the home page.
Official documentation: Apache DirectoryIndex, Nginx index directive, Chrome homepage and startup page, Edge home page.