Apache 413 request entity too large error

A

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:

  1. On your server use your favorite text editor, e.g. nano .htaccess
  2. Locate the following field: upload_max_filesize and adjust it to the amount of space required when uploading a file
  3. Similar to above, find the field labelled: post_max_size and adjust it
  4. Save the changes
  5. 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.

  1. Click File. Locate the root directory of your webserver e.g. (public_html). htaccess
  2. In some cases if the configurations are different, this is caused by the .htaccess is not accessible on the server
  3. Once you’ve found the file, Choose .Htaccess and press Edit button
  4. Copy & paste link to your computer
  5. Find and edit the two files mentioned above: upload_max_filesize and post_max_size
  6. Select Save and upload file
  7. And finally, restart your Apache webserver

Reference: Official Apache Source Documentation

About the author

By Jamie

My Books