How to Fix 413 Request Entity too Large Error in WordPress

1. Increase the PHP Memory Limit

The first step to fixing the 413 Request Entity Too Large error is to increase the PHP memory limit. This can be done by editing the wp-config.php file in the root directory of your WordPress installation.

2. Increase the Maximum Upload Size

The next step is to increase the maximum upload size. This can be done by editing the .htaccess file in the root directory of your WordPress installation.

3. Increase the Maximum POST Size

The third step is to increase the maximum POST size. This can be done by editing the php.ini file in the root directory of your WordPress installation.

4. Disable the WordPress Heartbeat API

The fourth step is to disable the WordPress Heartbeat API. This can be done by editing the wp-config.php file in the root directory of your WordPress installation.

5. Disable the WordPress XML-RPC

The fifth step is to disable the WordPress XML-RPC. This can be done by editing the functions.php file in the root directory of your WordPress installation.

6. Disable the WordPress Autosave

The sixth step is to disable the WordPress Autosave. This can be done by editing the wp-config.php file in the root directory of your WordPress installation.

7. Increase the Maximum Execution Time

The seventh step is to increase the maximum execution time. This can be done by editing the php.ini file in the root directory of your WordPress installation.

Ever tried uploading a file to WordPress only to see the 413 Request Entity Too Large error pop up? Annoying, right? Well don’t worry, we have a solution! In this article, we will teach you how to fix the 413 Request Entity Too Large error in WordPress.

Error code 413 Request Entity Too Large
Error type Client-side
Error variations 413 Payload Too Large
HTTP Status Code 413
Error causes Request too large
PHP limits too low
The page was not displayed because the request entity is too large.

The 413 Request Entity Too Large error means that the client’s request is too large to be processed by the server. The 413 error commonly occurs when uploading a file larger than the set server limit.

Hosting providers tend to have specific configurations on their server for uploading media to WordPress, and in most cases, these default settings provide sufficient resources for your posts and uploads.

However, in certain cases, you might need to upload a file that exceeds the size limit, and you will unfortunately face the 413 error.

How to Fix 413 Request Entity Too Large Error in WordPress

Luckily, there are a few ways to fix this issue. We will teach you three different methods of how to deal with the error 413 on WordPress.

Important! Two of the methods deal with important WordPress files, so we strongly suggest you back up your files before starting any configuration.

1. Modifying the functions.php file

You can find the functions.php file in your WordPress themes folder. This file is often used to define ‘classes’ and ‘actions’ on your WordPress site. It can add features and functionality like enabling post thumbnails, post formats, and navigation menus.

To modify functions.php access your Hostinger Control Panel. Then, go to the File Manager under the Files section.

Hostinger's File Manager in the hPanel

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

Functions file in wp_content folder.

Double click the functions.php file and add the following code snippet. It will increase It will increase upload_max_size, post_max_size and max_execution_time values.

@ini_set( 'upload_max_size' , '256M' );
@ini_set( 'post_max_size', '256M');
@ini_set( 'max_execution_time', '300' );
Editing functions.php file to set upload max size.

After you are finished, save the changes and try head back to WordPress admin area to test if you still get HTTP 413 error.

2. Modifying .htaccess file

The second method involves editing the .htaccess file, so be cautious not to make any unnecessary changes.

The .htaccess file is a configuration item which is read by the server. It can override server configuration settings for things like authorization, caching, or even optimization.

To reach the .htaccess file, you need to go to your public_html folder in your Hostinger control panel. On the right side, you will see the .htaccess file. Double click on it.

Locating Htaccess File in Hostinger Control Panel

You will get a popup window where you can add in the code. Read through the lines, when you find # END WordPress at the end of the file, paste in the following code under it:

php_value upload_max_filesize 256M
php_value post_max_size 256M
php_value max_execution_time 600
php_value max_input_time 600
Editing htaccess file to modify upload max size.

Make sure you save the modification and close the window. Go back to WordPress admin area and try upload a new.

3. Modifying Nginx Configuration

If you use a Hostinger VPS, you’ll get control over most of your server environment. We only reach basic server software (Apache or Nginx) in its default state. That means if you want to tweak more, you are free to revise it.

When the web server is set to restrict large file sizes, it can cause the 413 error request entity too large. Nginx has client_max_body_size to allow the maximum size of the client request body. If the request exceeds the value, an error message emerges. That means we need to reconfigure Nginx to allow the size we want for uploading files.

Reconfiguring nginx.conf will require a text editor. We recommend Vi text editor as it will handle the job perfectly.

Access your VPS via ssh and type the following command on 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 example below. It sets the maximum body size of a client request that the server allows. So, make sure you put the right number as your maximum size.

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

Save and close the file. Then, you can reload the Nginx web server with this following command:

# nginx -s reload

Now you can go ahead and check if the error 413 is gone.

Conclusion

If you want to upload a file larger than allowed by your server, you will face the 413 Request Entity Too Large error in WordPress. In this tutorial, we overviewed 3 different methods to fix 413 error.

How to Fix 413 Request Entity Too Large Error in WordPress

Are you getting a 413 Request Entity Too Large error when trying to upload a file to your WordPress site? This error occurs when the size of the file you are trying to upload exceeds the maximum allowed size set by your web server. Fortunately, there are a few simple steps you can take to fix this issue.

What Causes the 413 Request Entity Too Large Error?

The 413 Request Entity Too Large error is caused by the web server not allowing the size of the file you are trying to upload. This is usually due to the server’s configuration settings, which limit the maximum size of files that can be uploaded. The exact size limit will depend on your server’s configuration, but it is usually set to a few megabytes.

How to Fix the 413 Request Entity Too Large Error

The first step to fixing the 413 Request Entity Too Large error is to increase the maximum file size limit on your web server. This can be done by editing the server’s configuration file, usually called “php.ini”. You will need to find the line that says “upload_max_filesize” and increase the value to the size of the file you are trying to upload. Once you have saved the changes, you should be able to upload the file without any issues.

If you are unable to edit the server’s configuration file, you can also try increasing the maximum file size limit in your WordPress settings. To do this, go to the Settings > Media page in your WordPress dashboard and increase the “Max upload file size” value to the size of the file you are trying to upload. Once you have saved the changes, you should be able to upload the file without any issues.

Conclusion

The 413 Request Entity Too Large error is caused by the web server not allowing the size of the file you are trying to upload. Fortunately, there are a few simple steps you can take to fix this issue. You can either increase the maximum file size limit on your web server or in your WordPress settings. Once you have done this, you should be able to upload the file without any issues.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?