I strongly advise you to heed the advice already given. If your PHP is well structured and you take advantage of caching methods, it won't have a significant increase on your page load time. We've got pages with extremely complex queries that are hardly optimized, but using some clever caching methods, we're able to get those pages served in 500-900ms, or 2-3s for some of the much more complex pages.
It's a much better long term solution than using a static HTML page as your homepage.
That said - if you still wish to proceed with a static HTML homepage instead (again, please don't, especially if the only reason is "page speed", since there are so many other ways to decrease your page load time)
... Still reading?
Method 1: .htaccess
The… 🙄… "generally accepted" way to do this is with a
.htaccess rule that targets your homepage only, such as
RewriteRule ^$ http://example.com/path-to-html.html [L,R=301]
Method 2: Page Template
Alternatively, to maintain some semblance to the WordPress ecosystem would be to set up a Page Template
- Add a
home.php (yes, PHP file) to your active theme directory:
Place the following "Page Template Header" code in that file (leave a note to your future self/fellow devs that say where the file is so it's less confusing):
* Template Name: My HTML Homepage
<!-- This page is generated outside of WP by: /wp-content/themes/CURRENT-THEME/home.php -->
<!-- Your HTML Code Here -->
Add a new Page with Pages > Add New with a recognizable name, such as "My HTML Homepage"
- On the right hand side, in the Template selector, choose "My HTML Homepage" as the template.
- In Settings > Reading change "Your Homepage Displays:" to "A Static Page", and pick the "My HTML Homepage" page you just added.
Method 3: Move your WordPress Install
You can also just install WordPress on a subdirectory, have
index.html in the root directory, and use .htaccess to remove the /wp from your URLs.
Method 4: Don't.
Again, I strongly urge you to consider other methods:
- Taking advantaged of PHP 7.x and memcache/d
- Caching plugins like WP Super Cache/W3 Total Cache
- Optimizing your images (manually or with WP Smush)
- Optimizing Script/Style delivery (WP Hummingbird can help with this):
- Combine files where appropriate/able
- Minify those files
- Serve those files from a CDN
- Remove unnecessary plugins from WP, optimize JS functions, remove unused CSS selectors, etc.