Apache 413 request entity too large error
Ugh, I’ve been stuck on this one for a file and finally found my solution, so I thought I would definitely share it with you. So you’re coming here because you’ve received the dreaded 413 Request Entity too Large error. Keep reading because I have your solution!
You can set the maximum size of Apache servers through the files: .htaccess.
This error is very specific to Apach servers; however, I’ve also got the solution with: Nginx 413 Request Entity Too Large Error
Modify .htaccess
If your website has been built on a Apache server, the maximum limit on your server can be increased using the above steps:
- On your server use your favorite text editor, e.g. nano .htaccess
- Locate the following field: upload_max_filesize and adjust it to the amount of space required when uploading a file
- Similar to above, find the field labelled: post_max_size and adjust it
- Save the changes
- Restart Apache webserver
Here is an example of editing your .htaccess file setting both of these values:
php_value upload_max_filesize 4M
php_value post_max_size 5M
In the above example, I’ve randomly chosen 4 for the php_value upload_max_filesize and 5 for php_value post_max_size, but you can set this higher or lower based on your needs.
To ensure that file uploads work correctly, the post_max_size directive should be a little larger than the upload_max_filesize. For example, to set a file upload limit of 20 megabytes, you could set the upload_max_filesize directive to 20M, and the post_max_size directive to 21M.
If this doesn’t help try Nodejs 413 request entity too large error
Modify via the GUI
If you your web server has a GUI: Choose File Manager on your browser’s menus so we can start the same process above of modifying the .htaccess file.
- Click File. Locate the root directory of your webserver e.g. (public_html). htaccess
- In some cases if the configurations are different, this is caused by the .htaccess is not accessible on the server
- Once you’ve found the file, Choose .Htaccess and press Edit button
- Copy & paste link to your computer
- Find and edit the two files mentioned above: upload_max_filesize and post_max_size
- Select Save and upload file
- And finally, restart your Apache webserver
Reference: Official Apache Source Documentation