You must have noticed that the error name “413 Request Entity Too Large” contains a hint as to the solution and problem.
Before you begin digging, here’s a bigger hint: it’s in the word “Large.” In other words, the “413 Request Entity Too Large” error is a size issue.
When a client sends a request that is too large for the end server to handle, this error occurs.
Depending on the nature of the fault, the server may terminate the connection and block any future requests.>Let’s break down the error into its components:
- “413”: This is one of the 4xx error codes (like 401 Unauthorized error, 403 Forbidden Error, 404 Not Found Error), which indicates a server-browser issue.
- “Request Entity”: In this situation, the “entity” is the data payload that the client is requesting from the server.
- “Too Large”: The entity is too big for the server to handle.
To be more specific and provide more clarity, this error has been renamed from what it was previously known as. Although the issue is now recognized as the “413 Payload Too Large” error, you’ll still see it referred to by the previous term many times.
The simple explanation for why the issue occurs is that the server is configured to reject huge explicit uploads.
Consider when you upload a file with a maximum file size limit: in most circumstances, there will be some validation in place to prevent the issue, but, if you’re getting the “413 Request Entity Too Large” error, those validation attempts might not be as foolproof as you believe.
Resolving the Error 413 request Entity Too Large, from its roots
Here are the three basics and most efficient ways to resolve the error from its roots.
Fix 1: Making edits in the Functions.php file.
First and foremost, you can work with your WordPress functions.php file to assist increase the file upload size for your site.
Step 1: To do so, go to your hosting control panel and log into your site using SFTP with the credentials you found in the control panel.
Step 2: You’ll want to look for the file itself once you’ve gotten in. The functions.php file should be located in your server’s root directory. This root is often referred to as www or public_html, or it might be the abbreviated name of your website.
Step 3: Once you’ve located it, open it in your preferred text editor. If you don’t see the file, use your text editor to create it.
Step 4: Once you’ve opened a file, type the following:
@ini_set( ‘_max_size’ , ’64M’ );
@ini_set( ‘post_max_size’, ’64M’);
@ini_set( ‘max_execution_time’, ‘300’ );
In brief, this increases the maximum file size for posts and uploads while also increasing the amount of time the server spends attempting to process the request. The numbers here can be whatever you like, but they must be large enough to cover the inaccuracy. In practice, 64 MB is plenty for all but the most intensive jobs.
Step 5: When you’re finished, save your work and re-upload it to the server.
Then see if the “413 Request Entity Too Large” issue is still present. If that is the case, move further.
Fix 2: Making edits in the .htaccess file
Your .htaccess file, like your functions.php file, is stored on your server. The difference is that .htaccess is an Apache server configuration file. You won’t see this file in your setup if you use Nginx servers. This is the strategy you’ll need if you’re using an Apache server.
Here is how to follow this fix.
Step 1: Similar to the instructions for functions.php, log into your server through SFTP first, then look in your root folder.
Step 2: The .htaccess file should be located in this directory, but if it isn’t, contact your host to find out where it is and whether your server is running on Nginx instead.
Step 3: Once you’ve located it, reopen it. There are a few tags, the most significant of which is # END WordPress. After this, copy and paste the given below lines:
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
In a nutshell, this is almost the same as adding code to the functions.php file, but it’s more like giving the server explicit instructions.
Step 4: Save your edits, upload the file, and double-check your site when you’re done.
If you’re still having issues, we recommend contacting your host again, since they’ll need to double-check several aspects of your setup.
Fix 3: Increasing the upload limit from Nginx Server.
Client_max_body_size is a directive for Nginx users that determines the maximum size of an HTTP request. Because the web server is configured to limit huge file sizes, the 413 error request entity too large occurs.
Nginx provides a setting called client_max_body_size that allows the client request body to be as large as it wants to be. An error notice appears if the request exceeds the value. That means we’ll have to change Nginx’s configuration to accept the file sizes we desire for uploading.
This directive may already exist in your nginx.conf file, which may be found at /etc/nginx/nginx.conf. If it isn’t, you can define a value for that directive in either an HTTP, server or location block.
server {
client_max_body_size 100M;
…
}
This directive’s default value is 1M (1 megabyte). You can change the value to 0 if you don’t want a request size limit.
Once you’ve found the value you want, save your changes and reload Nginx with the command service nginx reload.
Conclusion
Even though WordPress is a rock-solid platform, you’ll encounter a variety of WordPress issues over time, including the WordPress HTTP Error, WordPress Memory Limit error, etc.
The “413 Request Entity Too Large” issue, on the other hand, is caused by your server, not WordPress. As a result, this problem requires a different response than other platform-specific issues.
There’s no reason you can’t repair this mistake quickly if you know how to use SFTP. It has to do with the upload size defined in your server configuration files, therefore you’ll have to dive into your .htaccess or nginx.config files.
It’s simple to open your text editor and make the necessary modifications to these files, and you may also contact your web hosting service provider to get the issue resolved.