redirect the homepage using .htaccess outside of WordPress

As @JacobPeattie suggested in comments:

If you just add index.html to the root of your WordPress installation that should become the homepage.

This does, however, require that the DirectoryIndex is set appropriately. For example:

DirectoryIndex index.html

The DirectoryIndex is the document that Apache tries to serve when you request a directory. In this case, the document root. Specifying a relative URL-path will look for that file relative to the directory being requested.

Or, to have multiple directory index documents (that are tried in turn):

DirectoryIndex index.html index.php

(index.php would ordinarily be required for WordPress.)

You can change index.html to anything you like.

You can also specify a file in a specific location elsewhere on the filesystem (providing it is publicly accessible). For example:

DirectoryIndex /path/to/alternative/homepage.php

But this will mean that if you request /path/to/any-directory/ then it will also serve /path/to/alternative/homepage.php (via an internal subrequest).

The default WordPress front-controller (directives in .htaccess) don’t do anything when you request the homepage (or any directory for that matter). It relies on mod_dir (ie. DirectoryIndex) to make the internal subrequest for index.php. Only when you request /<something> might the request be manually rewritten to index.php.


Alternately, you can use mod_rewrite, before the WordPress front-controller to internally rewrite the request for the homepage (/) to your alternative homepage.

For example:

# Internal rewrite to alternative homepage
RewriteRule ^$ /path/to/alternative/homepage.php [L]

# BEGIN WordPress
# : (WordPress front-controller goes here)

If you did literally want to “redirect” to a temporary homepage then you just need to add the R flag to the above directive. (Although the internal rewrite/subrequest, as mention above, would be preferable in most scenarios.)

For example:

# External "redirect" to alternative homepage
RewriteRule ^$ /path/to/alternative/homepage.php [R,L]

# BEGIN WordPress
# : (WordPress front-controller goes here)

Note that this is a 302 (temporary) redirect.