When building and maintaining a website, you’re bound to encounter some unexpected HTTP errors here and there. Problems like these are tough to avoid, and some are trickier to resolve than others.

If you’re experiencing a “413 Request Entity Too Large” error, the good news is that issue is quick and simple to address — you just need to do a bit of server reconfiguration. And no, you don’t need to be a technical expert. Let’s learn how.

Download Now: Free Intro Guide to HTML & CSS

Web servers place size limits on uploads to prevent users overwhelming the server and exceeding storage permissions. This limit usually isn’t an issue. However, large file uploads may occasionally exceed it, resulting in a message like this:

a 413 request entity too large error display message

While you can find ways to reduce the size of your upload, it’s also possible to change your limit and avoid this error with some server-side modification.

How to Fix a “413 Request Entity Too Large” Error

Your default upload size limit depends on your server setup. In this guide, we’ll show you how to fix a 413 error by increasing your size limit with a WordPress setup, and with Apache or Nginx server configuration. All methods require minimal edits to your server files, so we recommend running a backup before attempting the steps below.

WordPress

Themes and plugins are common causes of the 413 error with the WordPress content management system. There are several ways to increase your upload size limit enough to let these larger files through. As long as you do not exceed the limits of your hosting plan, try any of the following:

Modify PHP.ini

The easiest method to increase your upload limit is by modifying your server’s PHP.ini file. Here you can change your limit through the cPanel interface without any coding. To do this:

1. In your cPanel menu, select MultiPHP INI Editor under Software.

2. In the window that appears, choose your domain from the dropdown menu.

3. Change the values of the following parameters to your preference:

  • 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)

4. When finished, click Apply.

Modify .htaccess

If your WordPress site is hosted on an Apache server, it’s also possible to increase your server’s limit via .htaccess, a file that contains many directives for the server. See the solution below.

Modify functions.php

You can also try upping your limit via the functions.php file of your current WordPress theme. We recommend trying the above approaches first if you want to make this change permanent, as you’ll need to update functions.php whenever you update or change your current theme.

1. In your cPanel menu, select File Manager under Files.

2. Navigate to the folder of your current theme inside your root WordPress directory  (public_html by default). Open this theme file.

3. Select functions.php and click the Edit icon.

4. Copy the code below and paste it at the end of the file

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

5. Click Save.

This sets the maximum allowed size of your WordPress uploads and posts to 64 megabytes — of course, you can change this number. It also sets the maximum period your uploads can take to 300 seconds. Feel free to toggle this as well.

Nginx Server

Nginx server settings can be modified inside nginx.conf. Open this file and check for the directive client_max_body_size and change the value (in megabytes) to your preference.

If you do not see this directive in nginx.conf, you can add it to the end of a server, location, or http block like so:

 
server {
          ...
          client_max_body_size 64M;
}

This allows for a 64 megabyte upload. Set this number to your preference, save the file, then reload Nginx for the change to take effect.

Apache Server

Change the size limit on an Apache server by changing your .htaccess file:

1. In your cPanel menu, select File Manager under Files.

2. In your root WordPress directory (public_html by default), locate .htaccess. Depending on your settings, it may be hidden.

3. Select .htaccess and click the Edit icon.

4. Copy and paste the code below at the bottom of your .htaccess file:

 
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

5. Click Save and reload Apache.

This sets the maximum allowed size of your WordPress uploads and posts to 64 megabytes and sets the maximum file upload time to 300 seconds.

Fixing a 413 Error

While HTTP errors can be frustrating, many are quickly solvable, including a 413. By finding and tackling this issue now, you’ll have one less thing to worry about while building out your website. If your site allows users to upload their own content, changing your upload size limit solves this problem too — just make sure you’re not exceeding the limits set by your hosting plan.

If none of the above solutions work, the issue may stem from your CDN. In this case, you should consult the documentation or contact product support to resolve the error.

New Call-to-action

 css introduction

Originally published Jan 14, 2021 7:00:00 AM, updated January 14 2021

Topics:

Content Management System