How to Fix ‘413 Request Entity Too Large’ Error on WordPress

How to Fix '413 Request Entity Too Large' Error on WordPress

Looking for ways to fix the “413 request entity too large” error on your WordPress website? 🤔

Or, some situations, you might see this error as “413 payload too large.”

Either way, the “413 request entity too large” HTTP error appears when you are trying to upload a file that exceeds your server upload limit.

Because it’s a server-level HTTP error, it’s not specific to WordPress. However, a lot of WordPress sites can experience this error because of their server’s configuration.

The solution 🎯 to this problem is to upload smaller files or increase your web server’s upload limit if possible. Or, in urgent situations, you might bypass the error by uploading the file via FTP.

👉 In this article, we will show you how to fix the “413 request entity too large” error by reducing the file size and/or increasing the upload limit of your WordPress website.

Let’s get started.

📚 Table of contents:

  1. Upload smaller files
  2. Upload the file via FTP instead
  3. Modify PHP.ini
  4. Modify functions.php file
  5. Modify .htaccess file
  6. Modify nginx.conf file

What causes the “413 request entity too large” error?

Every hosting server sets an upload limit, which is generally sufficient for uploading a file to a WordPress website.

Some files, be it images, plugins, or themes, are larger than your typical files and demand more storage space.

When you try to upload such files to your WordPress site, they exceed the upload limit and overwhelm the server.

That’s when the server shows you the “413 request entity too large” error.

The error itself offers further insight into the problem when it’s broken down into the following parts: “413,” “request entity,” and “too large.”

  • “413” refers to the 4xx HTTP errors, which are generally related to problems between a hosting server and the browser.
  • “Request entity” refers to the request being made to the server.
  • And “too large” refers to the request being much bigger than what the server can serve.

Fortunately, the error can be easily 😎 overcome by reducing the file size or increasing the upload limit.

In the next section, we will show you how to fix the error and upload large files to your WordPress website. 👇

How to fix the ‘413 request entity too large’ error

Below, we’ll share six different solutions to this problem. The first two solutions are focused on bypassing the issue, while the final four solutions involve adjusting your server’s settings to fix the issue permanently.

⚠ Before you proceed, take a backup of your entire website just in case.

In the following tutorial, you will need to go to the backend of your website and make modifications to important WordPress files. This is risky business. A single misstep and you can end up with a broken website.

If things do go wrong, you can use the backup to get your site up and running in no time. So take a backup before you dive into the solutions.

1. Upload smaller files

The easiest solution is to upload a small file to your WordPress website.

If you are uploading an image, be sure to reduce the size using tools like TinyPNG and IMG2Go.

💡 On another note, using an image optimization solution like Optimole might help as well.

If you are uploading a plugin or a theme, then try finding an alternative plugin or theme that comes packed in a smaller size.

For many of you uploading a smaller file may not be possible. In that case, try the next solution.

2. Upload the file via FTP instead

Another way to bypass this issue is to try uploading the file via FTP instead of doing it from inside your WordPress dashboard.

Depending on your server’s configuration, this may or may not work. However, it’s good to check for two reasons:

  1. If it works, you’ll be able to get the file uploaded to your server.
  2. If it doesn’t work, you can be confident that it’s a server-level issue rather than anything wrong with WordPress itself.

For plugins and themes, you can upload them straight to the relevant folder.

For media files, you can upload them straight to the relevant uploads folder. However, you would need to use a plugin like Add From Server to register them to the WordPress Media Library if you want to access these files in the Media Library.

👉 For more, check out our full WordPress FTP guide.

3. Modify PHP.ini

The PHP.ini files control file upload sizes, file timeouts, and resource limits. You can use this file to increase the upload limit of your WordPress website.

Here’s how to do it in cPanel – the steps at your host might be slightly different if your host doesn’t offer cPanel.

Step 1: Open your hosting account and go to cPanel and look for the PHP.ini file.

Some hosting providers have the file located in the File Manager. So if you can’t find the PHP.ini file in cPanel, open File Manager in cPanel.

Step 2: In the File Manager, you will find the PHP.ini file inside the public_html folder or in the folder named after your website.

php.ini file in publichtml folderThe php.ini file in public_html folder

Step 3: Right-click on the PHP.ini file and select Edit. You should be able to see the following code:

max_execution_time (max time to upload)
upload_max_filesize (max upload size)
post_max_size (max post size)

Step 4: Change the values to a number of your preference. And hit the Save Changes button before exiting.

Now, open your WordPress dashboard and check if you can upload the file without encountering the error.

Need more help? ⌛ Then check out this guide on modifying the PHP.ini file.

4. Modify functions.php file

The functions.php file is part of your theme and it dictates how the theme functions on your website. It also enables you to add new functions to your website.

You can increase the upload limit of your website via the functions.php file.

While the function.php file can be accessed from the File Manager, we don’t recommend using it directly.

The function.php file is super important. So, changing it directly is too risky. Standard practice involves using a child theme or a free plugin like Code Snippets.

Creating a child theme is a time-consuming and difficult task. Therefore we recommend using the plugin.

Step 1: Install and activate Code Snippets on your WordPress website.

Step 2: On the left-hand menu of your WordPress website, you will find a new menu called Snippets. Go to Snippet and select Add New.

Step 3: Copy and paste the following code into the Functions section:

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

Be sure to enter a title and then hit the Save and Activate button before exiting the page.

If you still can’t upload a large file to your site, then try increasing the values of upload_max_size and post_max_size.

inserting code using code snippet pluginInserting code using the Code Snippet plugin

5. Modify .htaccess file

If your WordPress site is hosted on an Apache server, then you can increase the upload limit by modifying the .htaccess file. Here’s how:

Step 1: Use a tool like iplocation and dnschecker to make sure your servers are running on Apache.

Step 2: Open your hosting account and go to cPanel → File Manager → public_html → .htaccess.

Right-click on .htaccess and then select Edit.

Alternatively, you can connect to your server using FTP and edit the .htaccess file that way.

Step 3: Then copy and paste the following code at the end of the 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

Save the file before exiting and then try uploading large files to your WordPress website.

inserting code in htaccess fileInserting code in the WordPress .htaccess file

6. Modify nginx.conf file

Besides these, there is another method involving the nginx.conf file, which you would need to use if your server uses Nginx instead of Apache (because Nginx doesn’t support the .htaccess file). To implement this method, you will need to have advanced technical knowledge. So, this method is best left to developers who know how to locate the file and make modifications to it.

The nginx.conf file contains a directive that looks like this:

server {
          client_max_body_size 18M;

All you need to do is modify the number to 64M and check if you can upload large files to your site.

Fix the “413 request entity too large” error for good

The “413 request entity too large” message, AKA “413 payload too large,” is a common HTTP error that you might experience in WordPress.

It appears when you are trying to upload a large image, plugin, or theme that exceeds your server upload limits.

In order to overcome this obstruction, you can either reduce the size of the file or increase the server upload limits.

To reduce the file size, 🧩 you can use image compression tools or find small-sized alternative plugins and themes.

To increase the server upload limits you can modify certain WordPress files like PHP.ini, functions.php, .htaccess, and nginx.conf.

That’s it folks! 🤩 With that, we have come to the end of this tutorial.

Have any questions about the “413 request entity too large” error? Then, let us know in the comment section below.

Free guide

5 Essential Tips to Speed Up
Your WordPress Site

Reduce your loading time by even 50-80%
just by following simple tips.

Keep reading the article at ThemeIsle Blog. The article was originally written by Sufia Banu on 2022-08-04 08:01:04.

The article was hand-picked and curated for you by the Editorial Team of WP Archives.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

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

Show Your ❤️ Love! Like Us
Scroll to Top