If you've uploaded a static HTML file to your WordPress site's directory and it shows a 404 error or loads your WordPress theme instead of the HTML page, the problem is WordPress's permalink rewrite rules. WordPress intercepts nearly all requests and routes them through its own system, which means your standalone HTML file never gets served directly by Apache.
Add a rule to your .htaccess file that tells Apache to serve the HTML file directly before WordPress processes the request. Add this line before the # BEGIN WordPress block: RewriteRule ^yourfile\.html$ - [L]
01. Why This Happens
When WordPress is installed, it adds rewrite rules to the .htaccess file in your public_html directory. These rules look like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The key conditions are RewriteCond %{REQUEST_FILENAME} !-f and !-d, which mean "if the requested file doesn't physically exist and isn't a directory, route it through WordPress." In theory, if your HTML file physically exists, Apache should serve it directly.
However, there are situations where this breaks:
The file was uploaded to the wrong location - If the file isn't in the exact path Apache expects, the "file exists" check fails and WordPress takes over.
Nginx reverse proxy is caching - On Ultra Web Hosting servers, ea-nginx sits in front of Apache. Nginx may be serving a cached WordPress 404 response instead of checking for the file directly.
Permalink conflicts - If you have a WordPress page or post with the same slug as your HTML filename (e.g., a page called "about" and a file called about.html), WordPress claims the URL first.
02. The .htaccess Fix
The most reliable fix is to add an explicit rule that tells Apache to serve your HTML file directly, bypassing WordPress entirely. Add this above the # BEGIN WordPress block:
# Serve static HTML files directly
RewriteEngine On
RewriteRule ^mypage\.html$ - [L]
RewriteRule ^landing/(.*)$ - [L]
# BEGIN WordPress
...
The [L] flag means "last rule" - Apache stops processing rewrite rules and serves the file as-is. The first line handles a single file, the second handles an entire subdirectory of static files.
Always add your rules above the # BEGIN WordPress block, never inside it. WordPress regenerates the content between # BEGIN WordPress and # END WordPress when you save permalink settings, which would erase your custom rules. For more on .htaccess structure, see our complete .htaccess guide.
03. Using a Subdirectory
A cleaner approach for multiple static HTML pages is to put them in their own subdirectory with a separate .htaccess file that prevents WordPress from interfering:
public_html/
wp-config.php
.htaccess (WordPress rules)
static/
.htaccess (empty or minimal - no WordPress rules)
page1.html
page2.html
css/
images/
The static directory's .htaccess can simply contain:
RewriteEngine Off
This disables all rewrite rules within that directory, so Apache serves files directly without WordPress involvement.
04. Using a Subdomain
If you have a significant amount of static HTML content, creating a subdomain (like pages.yourdomain.com) is the cleanest separation. The subdomain gets its own document root with no WordPress installation, so there's no conflict at all.
- Create the subdomain in cPanel - Go to Domains > Subdomains (or Domains on newer cPanel versions)
- Upload your HTML files - Upload to the subdomain's document root (usually
/home/username/pages.yourdomain.com/) - No additional configuration needed - Apache serves the files directly
05. Embedding HTML in a WordPress Page
If you don't need a completely separate HTML file and just want to use custom HTML within your WordPress site, you can create a WordPress page and paste your HTML into it:
Block Editor (Gutenberg): Add a "Custom HTML" block and paste your HTML code directly into it.
Classic Editor: Switch to the "Text" tab (not "Visual") and paste your HTML.
This approach keeps everything within WordPress, maintains your site's header/footer/navigation, and avoids any rewrite conflicts. The trade-off is that WordPress's CSS may interfere with your custom HTML styling.
If you need a completely blank page (no WordPress theme, no header/footer), consider a custom page template. Create a file in your theme directory with a Template Name comment and minimal HTML structure. This gives you a WordPress-managed page with full control over the output.
Need Help With Your Static Pages?
If you're having trouble getting static HTML files to coexist with WordPress, our support team can check your .htaccess configuration and nginx settings.
Open a Support TicketQuick Recap: Static HTML with WordPress
- Check file location - Make sure the HTML file physically exists at the exact path
- Add .htaccess rule - Put a RewriteRule above the WordPress block to serve the file directly
- Use a subdirectory - Put static files in a folder with
RewriteEngine Off - Consider a subdomain - Cleanest option for significant amounts of static content
- Avoid slug conflicts - Don't name HTML files the same as existing WordPress pages
Last updated March 2026 · Browse all WordPress articles
