How to upload an HTML file in WordPress?

HTML file in WordPress

Uploading HTML file in WordPress:

The WordPress is a built-in content type used for adding the pages to the website. It has pre-designed templates and themes to display the pages. It has some beautiful plugins that allow the user to create page templates with a drag and drop builder option. Sometimes, the user may really like to use their old website pages that are in HTML code. For this scenario, the user needs to upload the HTML pages in WordPress. It leads to 404 error in some of the cases. In this article, we will show you how to upload it without getting 404 error in WordPress.

Renaming the file:

The user needs to rename the file from index.html to index.php before uploading the file. Then add the files including HTML pages, CSS, and folders to a Zip archive. (To create a Zip archive, windows users need to right-click the file and click send to–>compressed Zip folder. After that simply drag and drop files and folders to it).

Uploading the Files:

Login to your cPanel and go to files section and click the file manager option. In the file manager, the user needs to navigate to the public_html and open it. Then add a folder by using “+” folder button present there in the left corner and create a new folder. After creating the folder successfully, open it and click the upload button present in the top menu and choose the zip file which user wants to upload to the website. Once the progress is completed, the user can see the completed status in progress bar.
Once the file is uploaded, the user should extract the zip file by click on Extract button from the top menu. The user can see files once the extract process has completed. The user can delete the zip file and it will not affect the HTML pages or folders. Now user can visit the page in the browser. If it shows 404 error then follow the below steps.

Adding Redirection Code:

When the user-facing 404 error after uploading HTML pages into WordPress, then the user need to add the below code to the .htaccess file to resolve the issue.

RewriteRule ^(.*)index\.(php|html?)$ /$1 [R=301,NC,L]

The above code will redirect the index.php file and load it in the browser. This is one of the common error faced by the users when they are trying to upload HTML pages in WordPress.

We hope that this article will help you to overcome this issue..!!


Please enter your comment!
Please enter your name here