Have you ever encountered a 413 Request Entity too Large error while uploading a file on WordPress? We are here to help you out. It might frustrate you if the error occurs on a regular basis. However, this will happen only while uploading a file. 

By the end of this article, you will have the fix to 413 Request Entity too Large error on a WordPress website. It is a simple fix but requires some amount of effort. Follow this guide & fix the 413 error permanently.

What is 413 Request Entity too Large Error?

You must be wondering What actually is this 413 Request Entity too Large Error? Why you are getting this on your WordPress website while uploading any file? Well, Here’s the brief about this error. It usually occurs only while uploading any large file to the WordPress website.

But if your file size exceeds the limit that has been configured for any upload on WordPress, it will end up showing 413 error. If the file is important to upload, you will have to fix the error for uploading such a large file. To do so, We are sharing some of the best methods that will resolve the 413 Request Entity Too Large error.

Methods to fix 413 Request Entity too Large Error in WordPress

So, here are the ways that you can use to fix the 413 Request Entity too Large Error on your WordPress website. We are going to share 3 methods out of which you can choose the one that you prefer. 

First of all, We would recommend taking a backup of your website. We are going to deal with configuring the core files of WordPress, which might result in changing files mistakenly. It is always good to have the latest backup of your website while editing the configuration files.

Method 1: By modifying functions.php file

As you must have got the idea, We are going to modify functions.php file from WordPress. This file has all the declarations about the functions and features of your WordPress deployment. The feature like post thumbnails, navigation menu, post formats, etc are a part of functions.php

In order to modify the functions.php file, you need to have the access to the File Manager. Either you use the cPanel or FTP clients to access the files. You can use any of the methods to access the functions.php file. To do so, follow the steps below:

  1. Firstly, Open the File Manager (via cPanel or FTP Clients).
  2. Open the public_html folder from there.
Themes Folder Under WPContent File in Hostinger Control Panel
  1. Now, open the wp-content folder.
  2. In the wp-content folder, you have to select the themes folder.
  3. From there, select the currently active theme.
  4. Right-Click on functions.php file, Select the Edit option from there.
  5. Once you have the access to edit functions.php file, You need to paste the following code. This code will modify the configuration & it will eventually increase the upload_max_size, post_max_size, & max_execution_times limits.
@ini_set( 'upload_max_size' , '256M' );
@ini_set( 'post_max_size', '256M');
@ini_set( 'max_execution_time', '300' );
  1. Once you are done pasting the code in your functions.php file, Save the file.
Editing FunctionsPHP Files to Set Upload Max Size
  1. Reload the WordPress dashboard. Clear the cache of your website.

Upload the same file again to check if the error still exists. This will have sorted the issue & you will not see the error again.

Also, you can follow the same procedure from the WordPress dashboard as well. All you need to do is edit functions.php from the WordPress dashboard.

To do so, click on Appearance > Theme Editor. Look for functions.php file from the sidebar which contains all the files. Edit the functions.php file the same as we have done above & now save the functions.php file.

Method 2: By Modifying .htaccess file

You can even modify the .htaccess file of your WordPress website in order to fix the 413 error. This is a very important file of your WordPress file, do not make any unnecessary changes in this file. Just to make sure, keep the latest backup of your website.

There are a lot of functions of a .htaccess file. It can change the optimize your website, change or modify the authorization, and a lot of other important stuff. Follow these steps to modify the .htaccess file of your WordPress website.

  1. Open the File Manager of your hosting (By cPanel or FTP Clients)
  2. Open the public_html folder from the file manager.
  3. You will see the .htaccess file, right-click on that & select edit option. {In some cases (.) dotfiles are hidden, you can change the settings of your File manager if you can’t see it}
Locating Htaccess File in Hostinger Control Panel
  1. Once you have opened the .htaccess file, You need to add a code into it. You need to paste the following code after ‘# End WordPress’. Make sure you paste it at the right position because that is going to matter as well. The code that you have to paste is:
php_value upload_max_filesize 256M
php_value post_max_size 256M
php_value max_execution_time 600
php_value max_input_time 600
  1. Save the changes in your .htaccess file. Once you do that, Open the WordPress dashboard.
Editing Htaccess to Modify Upload Max Size
  1. Clear the Cache on your WordPress website.
  2. Upload the same file that you were trying to upload before. Check if the error still persists.

You would not encounter the 413 error again. Make sure you have pasted the right code at right place. This is how you can resolve the 413 Error through modifying the .htaccess file.

You can use various plugins available on WordPress library to edit the .htaccess file directly from the WordPress dashboard. This will become easier if you don’t want to go through the cPanel or FTP clients for accessing the core files.

Method 3: Modifying Nginx configuration

The third method is to modify the Nginx Configuration. If you are on a VPS server, you will get access to Nginx & other related software from the console. You have to run different commands in order to change the configuration from Nginx. Don’t Worry, We are going to share each step that you can try easily.

We need to configure the Nginx to allow the maximum size that we would want to upload. You will require a text editor in order to reconfigure nginx.conf file. You can use any text editor of your choice for doing the process.

Now, you need to login to your server using SSH. You will require to have the root privileges in order to reconfigure the file. We are using VI text editor, you can prefer the one you like.

  1. We need to run the command at first as:

vi /etc/nginx/nginx.conf

  1. This will open the nginx.conf file in VI text editor. Now, We need to add some lines in the nginx.conf file. Also, it will set the maximum body size of the client request that your server would allow. Make sure, you are using the correct numbers in order to get your work done easily. These are the lines that you need to add in nginx.conf file:

# set client body size to 16M #

  1. client_max_body_size 16M;
  2. Save the changes by saving the file from your Text Editor. Now Close the Text Editor.
  3. Enter the below command in order to reload the Nginx web server:

# nginx -s reload

Once you are done, close the Terminal. Go to your WordPress dashboard. Upload the same file and check if the error is occurring again. Most probably, you will not see the error again while uploading the same file, just that you have entered the correct value in 2nd step.

So, This is how you could fix the 413 Request Entity too Large error on WordPress by modifying the Nginx configuration. 

Let’s Conclude

You will see the error again if you try to upload a file larger than the file size limit that you just defined. It is always a good option to select the maximum size supported by your server. This will not create many conflicts and you won’t see the error again.

That was all about the methods to fix 413 Request Entity too Large error on a WordPress website. If you are facing any issues or have some doubts, let us know through the comments. 

Happy Fixing😉!!

Previous ArticleNext Article

Leave a Reply

Your email address will not be published. Required fields are marked *