How to fix 413 request entity too large error in WordPress


Have you tried uploading files to WordPress and have 413 Request Entity Too Large errors displayed? Very annoying, right? Don't worry, we've got a solution for you! In this article, we will show you how to fix 413 Request Entity Too Large error in WordPress.





What is 413 Request Entity Too Large error?





Error 413 Request Entity Too Large occurs when you try to upload a file that is too large to the server. Typically, hosting providers have a special configuration for their server to upload media to WordPress. In many cases, the default configuration is already enough for your article.





However, sometimes when you upload a file larger than the allowable limit, you will get error 413.





How to fix 413 Request Entity Too Large Error in WordPress





Fortunately, there are several ways to fix this. We will show you 3 different methods for how to handle it.





Important: There are two methods of dealing with WordPress files, which are important, so we recommend that you back up files before starting any modifications.





1. Edit functions.php file





You can find the functions.php file in the WordPress theme folder. This file is often used to define 'classes' and 'actions' on your WordPress site. It can add features like post thumbnails activation, article formatting and navigation menus.





To edit functions.php,  you can access the Hostinger Control Panel . Then go to File Manager under Files section .





hostinger file manager




In Hostinger 's File Manager  , you will see 3 folders in the public_html folder . Click on the wp-content folder folder, open the theme folder and edit the functions.php file . Just make sure you select the correct file in the current directory.





wpcontent themes in Hostinger cpanel




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





  1. @ ini_set ( 'upload_max_size' , '256M' ) ;
  2. @ ini_set ( 'post_max_size' , '256M' ) ;
  3. @ ini_set ( 'max_execution_time' , '300' ) ;




fix function.php in cpanel hostinger




After you're done, save your changes and return to the WordPress admin area page to see if you have a 413 error.





2. Edit the .htaccess file





The second method is to edit the .htaccess file , but be aware that do not create any other unnecessary changes.





The .htaccess file is the configuration file read by the server. It can override server configuration parameters such as authentication, caching and server optimization.





To find the .htaccess file , simply open the public_html folder in Hostinger CPanel . You will see the .htaccess file here, open it.





htaccess in file manager in hostinger




You will see the text editor appear, find it to # END WordPress at the end of the file, and paste the following code below it:





  1. php_value upload_max_filesize 256M
  2. php_value post_max_size 256M
  3. php_value max_execution_time 600
  4. php_value max_input_time 600




fix htaccess file in cpanel hostinger




Save changes and close the editor window again. Go back to the WordPress admin page and try to upload a new file.





3. Edit Nginx configuration





If you are using Hostinger's VPS , you will be allowed to control most server parameters. When using Apache or Nginx by default, you can adjust it.





Error 413 appears when the limited web server uploads large files. Nginx has client_max_body_sizeparameter to limit the maximum size required by the client. If the request exceeds the above number, the 413 Request Entity error too Large will appear. So you just need to adjust this number configuration.





Configuring nginx.conf will need the text editor to edit. We will use Vi text editor to handle this issue.





Access VPS via SSH and enter the following command in the terminal to start editing with Vi:





en /etc/nginx/nginx.conf




Then, you can add the following line to nginx.conf file to increase the maximum body size when the client asks which server to execute the command.





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




Save and close the file. You can then restart Nginx web server with the following command:





# nginx -s reload




Epilogue





If you upload a file larger than the server's allowable level, you will get 413 Request Entity Too Large error in WordPress. In this tutorial we show you three ways to fix error 413. By increasing the limit of uploading to the function.php file or the .htaccess file or increasing the client's request limit to the server by editing the nginx.conf file.


1 Comments

  1. tried the functions.php and .htaccess as per given instructions, still the urna theme is giving same 413 error

    ReplyDelete

seo marketing wordpress seo seo hosting seo and marketing word press seo wordpress and seo wordpress marketing hosting seo seo press pro market seo seo & marketing seo e marketing e marketing seo seo pro wordpress marketing & seo seo di wordpress wordpress seo host hosting and seo wordpress hosting seo wordpress seo wordpress wordpress for marketing seo press wordpress marketing for seo
×