In this article, we’ll discuss a couple of different ways that you can upload an HTML file to your WordPress website.
Why Do You Need to Upload an HTML File to WordPress?
When you’re working with a WordPress website, you can use anything from static posts and pages to fancy dynamic features like image galleries, magazines, and eCommerce. You can implement many of these advanced features by just installing and configuring free plugins from the WordPress marketplace.
On the other hand, when it comes to the layout and theming of your website, WordPress allows you to choose from thousands of ready-made professional themes available in the market. When you combine these themes with page builder plugins, you can completely customize your front-end the way you want to. And if that's not sufficient, you can customize a theme or build your own theme to give a completely different look to your website.
Having said that, sometimes you might want to upload a specific HTML file which you’ve got from your old site, and you just don’t want to touch the rest of your WordPress installation. Specifically, you might have an HTML file which displays a completely different layout than your existing website, and you want to display it for specific campaigns. Or you might want to verify your website with Google by uploading an HTML file to the document root of your website.
Whatever the reason, we’ll go through a couple of ways to upload an HTML file to your WordPress website in this post.
How to Upload an HTML File
Let’s quickly summarize the different methods you could use to upload an HTML file:
- use the FTP client software
- use cPanel
- use the back-end editor
FTP Client Software
This is one of the easiest ways to upload files from your computer to the WordPress website. If you’ve got FTP access to your website, you could use the FTP client software to connect to your website and upload the necessary files. Keep your FTP credentials handy if you want to use this option. You'll need to have a host, username, password, and port.
There are different FTP clients available, and you need to choose one for your OS version. If you’re using *nix-based systems—Linux and Unix— you could use popular options like LFTP, gFTP, or FileZilla. On the other hand, WinSCP is one of the most popular options for Windows users.
Once you’ve installed your favorite FTP client, go ahead and open it. Enter the necessary information, as shown in the following screenshot, and connect. I’ve used the gFTP client.
Once you connect to the server, you should be able to see the list of files available in your WordPress installation. On the left-hand side, gFTP lists files on your local computer, and it displays remote site files on the right-hand side.
Now, it’s time to upload the desired file from your local computer to WordPress. On the left-hand side, navigate to the directory where the HTML file resides, select the file, and finally drag and drop it on the right-hand side. Alternatively, you could also double-click that file to upload it.
Once you’ve uploaded the file, make sure that the file is uploaded properly by visiting the https://your-wordpress-website/myhtmlfile.html URL in your browser.
So that’s how you can upload files from your computer to WordPress by using the FTP client software. In the next section, we’ll discuss how you can use cPanel to achieve the same thing.
In this section, we’ll see how you could upload an HTML file to your WordPress with the help of cPanel. Of course, you need to have cPanel access on your host to use this option! You can learn more about free WordPress hosting options here at Envato Tuts+.
Using cPanel is pretty similar to using FTP. You need to navigate to the WordPress installation directory and upload any desired files.
Go ahead and log in to your cPanel. On your dashboard, you should be able to see the following different options.
Next, click on the File Manager link on your dashboard, and that should take you to the screen which lists different files on your server. Navigate to the desired WordPress installation directory where you want to upload the HTML file. It should display files as shown in the following screenshot.
On the top of the screen, it displays different buttons that allow you to perform different file operations. Among them, the Upload button allows you to upload files from your computer, and that’s what we’re going to use in our case.
Go ahead and click on the Upload button, and it will display a popup screen as shown in the following screenshot.
Basically, it’s asking you to choose the file you want to upload. Click on the Select File button and choose the desired file from your computer. And then cPanel should upload the selected file to the desired directory. Once the file is uploaded successfully, you should be able to see the uploaded file in the list of files under your WordPress installation directory.
If there’s any error uploading your file, it will display a helpful message which allows you to take the necessary actions to fix the cause of the error. Mostly, errors are related to the directory permissions or the size of your file exceeding the upload limit.
In this way, cPanel allows you to upload files from your computer to your WordPress website. In the next and last section, we’ll see how you can upload a file from the WordPress dashboard.
In this section, we’ll discuss how you can upload HTML files with the help of the built-in media manager available on your WordPress dashboard.
Before you go ahead and exercise this option, however, you'll need to make changes in your WordPress configuration file. By default, WordPress allows you to upload files with specific extensions for security purposes. Mostly, you could upload files that belong to valid media files like .jpg, .gif, .png, .pdf, etc. On the other hand, you can’t upload files that have extensions like .html, .js, .php, and so on.
So if you want to upload a file which is not a valid media file and doesn’t belong to one of the valid media extensions in WordPress, you need to make a special change in your WordPress configuration file. Note that it must be a temporary change, and you must undo it once you finish uploading files. I would recommend you to use this option only if you know what you’re doing.
Go ahead and open the wp-config.php file with your favorite text editor. The wp-config.php file resides in the root of your WordPress installation. Add the following snippet at the end of your file.
Once you’ve done it, upload the updated wp-config.php file to your WordPress site. With these changes in place, you'll be able to upload .html files from your computer.
Next, head over to your WordPress dashboard and navigate to Media > Add New. It will display the following screen.
Click on the Select Files button, which allows you to choose files from your computer that you want to upload. Select the desired files, and they'll be uploaded right away, as shown in the following screenshot.
Now, navigate to the Media > Library section, and it should display the list of files. Click on the file which you’ve just uploaded to see the file details. You'll see the File URL field, which contains the link of this file, as shown in the following screenshot.
You could copy it and paste it in your browser to see if it works. This is the link which you would need to access this file in your front-end.
So that’s how you can upload files with the help of the media manager from your WordPress dashboard. Don’t forget to undo your changes in the wp-config.php file, as it would be a dangerous security problem to keep it open.
Today, we discussed different options that you could use to upload an HTML file to your WordPress website. Feel free to post if you have any queries or doubts using the feed below.
Install a Premium WordPress Widget or Plugin Now!
There are thousands of high-quality WordPress plugins on CodeCanyon that can help enhance your business's website. Have a look through this large collection of plugins, and you'll find helpful plugins in all different types of categories, from marketing to eCommerce to social media.
- 21 Best WPBakery Page Builder (Visual Composer) Addons and Extensions of 2022Daniel Strongin21 Aug 2021
- 21 Best WordPress Slider & Carousel Plugins of 2022Daniel Strongin01 Jun 2022
- 30 Best WordPress Calendar Plugins and Widgets (With 4 Free Plugins)Daniel Strongin23 Jul 2022
- 25 Best Popup & Opt-in WordPress PluginsDaniel Strongin31 Aug 2022
Find the perfect WordPress plugin to help your business succeed and motivate your customers. You can find even more plugin ideas and inspiration in our free course on finding the best WordPress plugins for your site.