Have you ever tried to upload a file for only 413 Request Entity? Annoying, is not it? Do not worry, we have a solution! In this article, we will teach you how to fix 413 Request Entity to Large Error in WordPress.
What is the 413 request entity too large error?
A 413 Request Entity in WordPress error occurs when you try to upload a very large file for your server. Typically, hosting providers have specific configurations on their server to upload media on WordPress. In most cases, default settings are more than enough for your post.
However, in some cases, you may need to upload a file that exceeds the size limit, and you will, unfortunately, suffer a 413 error.
Most of the chances have whenever you upload a plugin, theme, or any media file, you can see a too large error in the 413 request unit. You may have already figured that the server does not accept your file due to its size.
Each WordPress Support company configures its server in a specific file upload limit, and when the server detects a large file, it displays the error page. In order to maintain the best environment, the installation of this type of file upload limit is necessary.
You know very well – most WordPress users have shared web hosting, and a user can influence another’s performance. The server imposes some limitations to avoid any bad situation.
Why WordPress 413 Request Entity Too Large Error
Usually, this error occurs – if you are trying to upload a file that exceeds the maximum file upload limit on your WordPress site. Your web server will fail to upload the file, and you will see this error page.
Generally, a lot of WordPress hosting companies have their servers configured so that WordPress users can easily upload large images and other media. However, sometimes this setting is not enough to upload large themes or plugin files.
It also prevents uploading large files in the media library. In that case, you will see a different message, clearly saying that the file size exceeds the maximum allowable limit.
Let’s have a look :
How to fix WordPress 413 Request Entity Too Large error
1. Modifying the functions.php file
You can find the functions.php file in your wordpress theme folder. This file is often used to define to-do classes ‘and on action’ on your WordPress site. This post can add features and functionality such as thumbnail, post format and enabling navigation menu.
To modify the function. Access your hosting control panel. Then, go to File Manager under the File section.
In the wpglobalsupport File Manager, you will see three folders below the public_html folder. Click on the Wp-content folder which will give you a list of files on the right. Double-click on the theme folder to find the functions.php file. Make sure you select the file for the subject currently being used.
Double click on the functions.php file and add the following code snippet. This will increase the 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’ );|
After you finish, save the changes and go back to the WordPress Admin Area to test if you still get a 413 error.
2. Modifying .htaccess file
The second method involves editing the .htaccess file, so be careful not to make any unnecessary changes.
The .Htaccess file is a configuration item that is read by the server. It can override the server configuration settings for things like authorization, caching, or even optimization.
To access the .htaccess file, you must go to your public_html folder in your Hostinger cPanel. On the right side, you will see the .htaccess file. Double click on it.
You will get a popup window where you can add code. Read through the lines, when you get #END WordPress at the end of the file, paste it into the code below:
|php_value upload_max_filesize 256M php_value post_max_size 256M php_value max_execution_time 600 php_value max_input_time 600|
Make sure you save the amendment and close the window. Go back to the WordPress admin area and try uploading new ones.
3. Modifying Nginx Configuration
If you use a VPS server, you will get control over most of your server environment. We only access the basic server software (Apache or Nginx) in its default state. This means that if you want to tweak more, you are free to modify it.
413 Error request unit is too large because the web server is set to restrict large file size. Nginx has client_max_body_size to allow the maximum size of the customer request body. If the request is higher than the value, then an error message emerges. This means that we need to reconfigure Nginx to allow the size of the file to upload the file.
Configuring again nginx.conf will need a text editor. We recommend Vi Text Editor because it will handle the work completely.
To begin editing with VH, access your VPS through SPS and type the following command at your terminal:
After that, you can add the following lines to nginx.conf as shown in the example below. This client sets the maximum body size of the request the server permits. Therefore, make sure that you have placed the correct 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|