WordPress is primarily designed to handle blog posts and pages, but there are times when you might need to add a static HTML page to your website. This can be useful for custom designs or standalone content.
The challenge is that WordPress doesn’t automatically recognize these HTML pages, which can lead to 404 errors. We have seen many beginners struggling with this issue.
In this article, we will show you the correct steps to upload an HTML page to WordPress without triggering a 404 error. We use the same steps when adding an HTML page to a WordPress website.
Why Upload HTML Pages to WordPress?
WordPress comes with a built-in content type to add pages to your website. Often, WordPress themes add pre-designed page templates to display your pages.
Excellent WordPress landing page plugins allow you to create beautiful page templates with a drag-and-drop builder.
In most cases, you shouldn’t need to upload an HTML page to your WordPress site.
Expert Tip: We recommend using SeedProd, the best WordPress page builder plugin, to design custom pages. You can use its drag-and-drop interface to design your landing page. Plus, it comes with professionally designed templates to use as starting points.
However, you may sometimes have static HTML pages from your old website or a static template you like and want to use.
In these scenarios, you will need to upload your HTML page to WordPress.
Since WordPress comes with its own SEO-friendly URL structure, it may cause a 404 error if you simply upload your HTML page and try to access it.
That being said, let’s look at how to upload an HTML page to your WordPress site without causing 404 errors.
Uploading HTML Page to WordPress Site
First, you must prepare the HTML page you want to upload.
If it is a single HTML page with no separate CSS or image files, you can upload it as is.
However, if the page you want to upload has separate CSS files and images, then you need to place them in a directory structure.
Ideally, you would want to place your files in a folder on your computer.
Don’t forget to open your main HTML file to make sure that everything works as expected.
Next, you need to connect to your WordPress site using an FTP client or the File Manager app in your hosting account control panel.
After that, you need to upload the folder you created earlier to the root folder of your WordPress website. The root folder is the one that has the wp-admin
, wp-content
, and wp-includes
folders inside it.
After uploading your files, you can go to your website to view your HTML page.
If you uploaded the folder with HTML and accompanying CSS and image files, then you will need to add the name of the folder you uploaded to the end of your website address like this:
https://example.com/landing-page/
Note: The main HTML file in your folder should be called index.html. Otherwise, you will have to provide the name of the HTML file, too.
On the other hand, if you uploaded a standalone HTML file, then simply add the HTML filename to the end of your website address:https://example.com/landing-page.html
You will now see your uploaded HTML page.
If you run into an error page, then you will need to troubleshoot the error.
Troubleshooting HTML Page Upload in WordPress
Normally, you should be able to view your HTML page by visiting the page or folder directly.
However, due to the rewrite rules used by WordPress or your web server, there is a chance that you may run into some common WordPress errors.
1. Fixing 404 Error After HTML Page Upload in WordPress
The 404 error is one of the most common WordPress errors. However, it is quite easy to fix in most cases.
If you are seeing a 404 error after uploading your HTML page, then you just need to add a rewrite rule to your .htaccess file:
RewriteRule ^(.*)index\.(php|html?)$ /$1 [R=301,NC,L]
2. Fixing 403 Error After Uploading an HTML Page in WordPress
A 403 error may also occur due to file permissions on your newly uploaded HTML page or your uploaded folder.
Simply connect to your website using an FTP client and click to select the HTML page or the folder you uploaded.
Next, right-click and then select the ‘File permissions’ option in your FTP client.
This will bring up a file permission popup. Enter ‘755’ into the numeric value field and check the ‘Recurse into subdirectories’ option.
Below that, select the ‘Apply to all files and directory’ option and click on the ‘OK’ button.
This will set the file permissions for your HTML upload folder and all the files and folders inside it.
For more details, see our tutorial on how to fix file and folder permissions errors in WordPress.
Adding Your Custom HTML Page to XML Sitemaps
Now that you have uploaded your HTML page, it is time to let search engines know that it is part of your website.
The easiest way to do that is by adding it to the XML sitemaps for your website.
If you haven’t set up sitemaps yet, then follow the instructions in our article on how to add XML sitemaps in WordPress.
First, you’ll need to install and activate the All in One SEO for WordPress plugin. For more details, see our article on installing a WordPress plugin.
Upon activation, go to the All in One SEO » Sitemaps page. Under the General Settings page, make sure that the ‘Enable Sitemap’ toggle is turned on.
After that, scroll down a little to the Additional Pages section.
Slide the toggle to activate this section and then enter your HTML page or folder URL under the ‘Page URL’ option.
Click on the ‘Add Page’ button to add it.
After that, don’t forget to click the ‘Save Changes’ button to store your settings.
All in One SEO will now include your custom HTML page URL in your WordPress XML sitemaps. Search engines will be able to find the URL and treat it as any other page from your website.
Bonus Resources
The following are some additional resources that you may find helpful when dealing with 404 errors or managing pages on your website:
- How to Improve Your 404 Page Template in WordPress (2 Ways)
- How to Get Email Alerts for 404 Errors in WordPress
- Best Free 404 Redirect Plugins for WordPress
- How to Organize or Reorder WordPress Pages with Drag & Drop
We hope this article helped you learn how to upload an HTML page to WordPress without causing errors. You may also want to see our WordPress SEO guide to get more traffic or our beginner’s guide to WordPress speed and performance.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Moinuddin Waheed
perfect solution for adding custom html code for adding custom pages.
normally I use file manager to upload the codes and images.
But I have also used many times over the filezilla for uploading the files.
Thanks for the 404 error solution that normally comes after adding the html file.
Dennis Muthomi
This was really helpful!
I was able to upload the HTML files correctly using FileZilla and it actually worked without any issues. Adding the custom page to the XML sitemaps was also a great tip to make sure search engines can find it.
thanks for providing such a clear walkthrough!
WPBeginner Support
You’re welcome
Admin
Jiří Vaněk
Thank you for the advice. I tried it on FTP without success and the only thing missing for it to work was the htaccess code. Perfect.
WPBeginner Support
Glad our guide could help
Admin
Irene
Anytime I have any WordPress related question and I search on Google, I always know I would get the most reliable and very simplified explanation whenever I scroll to find WPbeginners article on the search results.
This article and your other articles have always been helpful. I’m glad I belong here. Thank you.
WPBeginner Support
Thank you, glad we can help solve any issues you run into
Admin
David Leitch
Hi Thanks for this article. It almost solves my workflow problem.
I have some excel files I update each week. I want to upload charts and tables from those files to word press each week. Preferably the upload would happen automatically but the only way I have seen to do this is to save the excel page as .htm. I wanted to save it into the wordpress directory and then use an embed link. Do you have a suggestion?
thank you
WPBeginner Support
For what it sounds like you’re wanting, you would want to take a look at our article here: https://www.wpbeginner.com/plugins/how-to-embed-pdf-spreadsheet-and-others-in-wordpress-blog-posts/
Admin
Raashid Din DAR
Found this article helpful. Keep the good work up.