These problems can be quite nerve-wracking as they can be difficult to avoid, and to top it all off, they can even be a bit trickier to resolve than other problems.
Fortunately, when you’re experiencing a “413 Request Entity Too Large” error, you should know that this issue is pretty easy to fix. All you need to do is to meddle a bit with the server configuration, and additionally, you don’t even have to be a tech wizard to pull it off.
As you might have guessed, this article is dedicated to discussing the issue mentioned above.
What Does The “413 Request Entity Too Large” Error Mean?
This 413 HTTP error code generally occurs when the size of a client request is larger than the server’s file size limit. Usually, you will experience something like this when you attempt to upload a larger file on a web server. In these cases, the server alerts the client with a 413 error code
Web servers usually place specific size limits on uploads. This is basically a preventive security measure to prevent the users from overwhelming the server and exceeding their storage permissions. These limits on their own rarely cause issues, however, occasionally, when you want to upload a large file and exceed the limits, you will get a message like this from the server.
The first thing you can do to fix the problem is obviously to reduce the size of the file you’re trying to upload. On the other hand, you can also try to change your upload limit with a bit of server-side modification.
Fixing a “413 Request Entity Too Large” Error
As said above, you can choose to reduce the size of the file you’re trying to upload, given that it makes sense in your situation.
As far as server-side modifications go, the way you will go about fixing (increasing) the default upload size limit will mostly depend on your server setup.
In this article, we will go over the basics of increasing your upload size limit in a WordPress setup, with either Nginx or Apache configurations.
All the methods we discuss here require minimal server file edits, so running the necessary backups before attempting the fix is highly recommended.
Also, you can also ask for help at your favorite digital agency.
With WP, plugins and themes can oftentimes lead to 413 errors with the WP content management system. There are a few ways you can navigate around this problem and increase upload size limits just enough to let these files through without problems. As long as the files don’t exceed the hosting plan’s limits, try these:
Modifying the PHP ini File
Essentially, this is the easiest method you can use to increase your upload size limits. You can simply change your limit here through the cPanel without any need for coding.
You only need to get in the cPanel menu, there select the MultiPHP INI Editor under Software.
Then, you will see a window where you can choose your domain from the dropdown menu and change the upload limit values to suit your preferences.
It should look something like this:
- max_execution_time (maximum time to upload, in seconds)
- upload_max_filesize (maximum upload size, in megabytes)
- post_max_size (maximum post size, in megabytes)
Once you’re done with that, you can simply click apply, and you’re ready to go.
If you are using Apache server as your host for your WordPress site, you can have the option of increasing your upload limit via the .htaccess file the contains several server directives.
Another way to increase your upload limit is by using the functions.php file of your WordPress theme.
Please note, if possible, try the first two strategies because if you modify the functions.php file you will need to update it whenever you change your current theme or update it.
So, go to your cPanel menu where under Files, select File manager. Find your theme folder and open it. Edit your functions.php by entering a specific code, and when you’re done, click Save.
Once done, this sets the largest allowed size of your WP uploads to a larger size (based on the code) but you can change the number.
Go to your Nginx server settings inside nginx.conf. To increase the upload limit, open this file and look for the client_max_body_size directive and change the value however you may like. Note, that the values are in megabytes.
If you can’t see the directive there, you can add it to the end of a HTTP block, location, or server as well.
After you’ve managed to hammer out this approach, you need to save the file and reload Nginx to have the changes take effect.
Changing upload size limits on such a server can usually be achieved by modifying the .htaccess file.
So, select File Manager in the cPanel menu under Files. There, locate the .htaccess file in your WP directory. Go to the edit icon, and enter the necessary code at the bottom of the .htaccess file. Save the changes and reload Apache.
HTTP Errors don’t Have to Cause Headaches
It’s a fact that all errors are frustrating. Luckily, when it comes to HTTP-related issues, many of them could be easily fixed and a 413 error is no exception.
If you come across this error, we recommend fixing it as soon as possible as you will have one less thing to look out for while you’re building your sites.
On the other hand, if you’re building a website that allows your users to upload their own content, then changing the size limit may also mean retaining regular visitors. Just make sure that you’re not exceeding hosting plan limits.
On the other hand, if none of the solutions that we’ve listed above work, then your issues may be stemming from CDN-related problems. If this is the case, you might want to take a closer look at the documentation or reach out to customer support to help you fix the issue.
Originally published at https://www.popwebdesign.net on October 18, 2021.