How to Fix “413 Request Entity Too Large” Error in WordPress

Have you ever tried to upload a file to WordPress and got a 413 Request Entity Too Large error? Annoying, right? Well don’t worry, we have a solution! In this article, we will teach you how to fix 413 Request Entity Too Large error in WordPress.

What does 413 Request Entity Too Large Error mean?

The 413 Request Entity Too Large error occurs when trying to upload a file that is too large to be processed by the server. Typically, hosting providers have specific settings on their server for uploading media to WordPress. In most cases, the default settings are more than enough for your posts.

However, there are cases where you may need to upload a file that exceeds the size limit and unfortunately you will see the 413 error.

How to Fix 413 Request Entity Too Large Error in WordPress

Fortunately, there are several ways to fix this problem. We will teach you three different methods to deal with this error in WordPress.

Important: Two of the methods involve important WordPress files, so we recommend that you do one before starting any setup.

1. Modify the functions.php file

you can find the file functions.php in the WordPress theme folder. This file is often used to define “classes” and “actions” on your WordPress site. There you can add features and functions like enabling post thumbnail images, post formats and navigation menus.

To modify functions.php access the Control Panel from . Then go to file manager in the section Records.

In the file manager of , you will see three folders under the folder public_html. Click on the wp-content folder and you will see a list of files on the right side. Double click on the themes folder to find the file functions.php. Make sure you choose the theme file you are currently using.

See also  Web designs: 10 sources of inspiration for your website

Double click on the file functions.php and add the following code, which will increase the values ​​of upload_max_size, post_max_size Y max_execution_time.

@ini_set( ‘upload_max_size’ , ‘256M’ ); @ini_set( ‘post_max_size’, ‘256M’); @ini_set( ‘max_execution_time’, ‘300’ );

When finished, save your changes and try to return to the WordPress admin area to check if the 413 error still appears.

2. Modify the .htaccess file

The second method is to edit the , so be careful not to make unnecessary changes.

The file .htaccess it is a configuration element that the server reads. You can override server settings for things like authorization, caching, or even optimization.

To access the file .htaccessyou must go to the folder public_html in the control panel. On the right side, you will see the file .htaccess. Double click on it.

A popup will appear where you can add the code. Read between the lines, and when you find # END WordPress at the end of the file, paste the following code below:

php_value upload_max_filesize 256M php_value post_max_size 256M php_value max_execution_time 600 php_value max_input_time 600

Make sure to save your changes and close the window. Go back to the WordPress admin area and try to upload your file again.

3. Modify Nginx configuration

If you use a , you will have control over most of the server environment. We will only be dealing with the basic server software (Apache or ) in its default state. That means that if you want to make further modifications, you are free to review it.

The 413 request entity too large error appears because the web server is configured to restrict the size of large files. Nginx has client_max_body_size to determine the maximum size of the client request body. If the request exceeds the value, an error message appears. That means we need to reconfigure Nginx to allow the size we want to upload files.

See also  Padding vs Margin: what's the difference in CSS?

to reconfigure nginx.conf a text editor is required. We recommend the Vi text editor as it will handle the job perfectly.

and type the following command in your terminal to start editing with Vi:

vi /etc/nginx/nginx.conf

After that, you can add the following lines in nginx.conf as shown in the following example. This defines the maximum size of a client request that the server allows. So make sure you put the correct number you want for the maximum size.

# set client body size to 8M # client_max_body_size 8M;

Save and close the file. You can then reload the Nginx web server with the following command:

# nginx -s reload

conclusion

If you want to upload a larger file than your server allows, you will get a 413 Request Entity Too Large error in WordPress. In this tutorial, we describe 3 different methods to fix it.

Gustavo is passionate about creating websites. He focuses on the application of SEO strategies at for Spain and Latin America, as well as the creation of high-level content. When he is not applying new WordPress tricks you can find him playing the guitar, traveling or taking an online course.

Loading Facebook Comments ...
Loading Disqus Comments ...