How to Fix the 413 Request Entity Too Large Error in WordPress
Experiencing the 413 Request Entity Too Large error in WordPress can be frustrating, especially when it interrupts your workflow.
The 413 Request Entity Too Large error is an HTTP status code that indicates the server is aware of the requested resource but refuses to process it because the request is too large. This error commonly occurs when attempting to upload large files or submit data-heavy forms. If you find yourself facing this issue, you may need to increase the server’s maximum upload size limit.
In this article, we will discuss effective methods to adjust the maximum file upload size in WordPress and provide tips to prevent the 413 Request Entity Too Large error from occurring in the future.
What Causes the 413 Request Entity Too Large Error?
Typically, your web host sets a server limit to prevent slow performance or downtime when handling backend operations. These limits are usually adequate for basic tasks like posting an article. However, certain website features may cause users to send larger amounts of data than the server can handle. If the requested resource or uploaded file exceeds the server’s limit, the server will terminate the connection and return the 413 Request Entity Too Large error message.
Another common cause of this HTTP status code is insufficient server resources, especially during peak traffic times. When too many users upload files simultaneously, the server can become overloaded, leading to this error.
Incorrect file permissions can also trigger the error message, as they may prevent the web server from accessing necessary files or directories. These restrictive permissions can hinder the server’s ability to process large requests or uploads properly, resulting in the error.
How to Fix the 413 Request Entity Too Large Error in WordPress
Now that we understand what can trigger the 413 Request Entity Too Large error, let’s explore several methods to troubleshoot and resolve it. Before proceeding, make sure to back up your website, and ensure you have administrator access to your web server and files.
1. Reset File Permissions
If incorrect file permissions are the cause of the HTTP error, resetting them should fix the issue. Users of Hostinger can easily accomplish this from the hPanel. Navigate to Websites → Advanced → Fix File Ownership, check the box confirming you want to reset file permissions, and hit Execute.
Fixing file ownership will reset permissions to the following values:
- 644 for files: The owner can read and write, while the group and others can only read.
- 755 for folders: The owner can read, write, and execute, while the group and others can only read and execute.
You can also change your file permission settings using your hosting provider’s File Manager or an FTP client like FileZilla. Here’s how to do it using Hostinger’s File Manager:
- Go to Websites → Dashboard and select File Manager.
- Right-click on your root directory (public_html) and choose Permissions.
- Check all the boxes except the writing permission for the group and others. Selecting Recursive will set the same permissions for the content inside folders. Hit Update.
Verify the permissions for the following files and folders within your root folder:
- 755 – wp-content folder and the uploads folder inside it.
- 644 – all files within the root folder, especially configuration files like .htaccess and wp-config.php.
For more detailed instructions, check out our guide on changing file permissions in Linux.
2. Increase the PHP Upload Size Limit via hPanel
The second method to fix the 413 Request Entity Too Large error is to increase the PHP maximum upload file size limits. These limits determine the largest file size that users can upload, the maximum data sent in a single request, and the memory usage allocated for handling large uploads.
The default limit varies by hosting provider but is often around 128 MB. Raising this limit allows your web server to handle larger file uploads, potentially resolving the 413 status code.
Users of Hostinger can modify maximum file upload size limits from the hPanel. Here’s how:
- Go to Websites → Advanced → PHP Configuration from the hPanel dashboard.
- Open the PHP Options tab, which contains your website’s PHP configuration settings.
- Scroll down to the memory_limit field and increase the script’s maximum memory usage. For instance, the Cloud Professional hosting plan offers up to 6144 MB.
- Locate the post_max_size field and adjust the maximum size allowed for all requests, including file uploads. Ideally, this value should be smaller than the memory limit.
- Finally, set the new maximum file upload size within the upload_max_filesize field, ensuring it’s lower than post_max_size to avoid errors during file uploads.
- Hit Save to confirm the changes.
3. Modify the functions.php File
For those not using Hostinger, you can increase the file upload size limit by modifying the functions.php file. This theme functions file defines a WordPress website’s functionality and allows you to add new code to adjust the maximum request and file size limits.
It’s important to modify the functions.php file within your child theme, as changes to the main theme’s file can be lost during updates. If your theme doesn’t have a child theme, follow our guide on creating a new WordPress child theme.
Here’s how to modify your theme’s functions.php file using Hostinger’s File Manager:
- Go to Websites → Dashboard and select File Manager.
- Open wp-content → themes within your root directory. Locate your child theme and double-click the functions.php file to edit it.
- Find the lines containing upload_max_size, post_max_size, and max_execution_time parameters, and increase their values. If you can’t find these rules, add the following code snippet to the bottom of the file:
@ini_set( 'upload_max_size' , '256M' );@ini_set( 'post_max_size', '256M');@ini_set( 'max_execution_time', '300' );
While adjusting the maximum execution time (max_execution_time) doesn’t directly resolve the 413 error, it can help in instances where large file uploads or data processing take longer, preventing timeout errors.
After saving the changes, check whether your file uploads successfully. If the 413 Request Entity Too Large error persists, consider increasing the values slightly or try the next methods.
4. Modify the .htaccess File
Another way to change the file upload size limit in WordPress is by editing the .htaccess file. This core WordPress file contains your web server’s configurations, including authorization, caching, and optimization.
Here’s how to edit the .htaccess file:
- Open your WordPress root directory using a File Manager or an FTP client.
- Double-click the .htaccess file to edit it. If you can’t find it, check our guide for steps to locate or create an .htaccess file.
- Add the following code snippet below the # END WordPress line:
php_value upload_max_filesize 256Mphp_value post_max_size 256Mphp_value max_execution_time 600php_value max_input_time 600
Adjusting the maximum time for parsing input data (max_input_time) helps ensure that long-running uploads and data processing tasks don’t time out.
Save the changes and check whether this fixes the error.
5. Modify NGINX Configuration
If you are hosting your WordPress site on a virtual private server, modifying the web server configuration can also help troubleshoot the 413 error code. The file upload size limit varies depending on the web server software used. In NGINX servers, the client_max_body_size setting controls the maximum file upload size.
To increase this limit, access the nginx.conf file via an SSH client like PuTTY or Terminal and edit the server settings using a text editor like Vi. Users of Hostinger can find their login credentials in the SSH access tab in the VPS overview menu.
Follow these steps to change your NGINX server configuration:
- Once connected to your VPS, enter the following command to open the configuration file using Vi:
vi /etc/nginx/nginx.conf
- Add these lines to change the maximum request body size that the server allows. For example, we will set it to 8 MB:
# set client body size to 8M# client_max_body_size 8M;
- Save and close the file by entering :wq and hitting Enter. Restart NGINX to apply the changes by entering the following command:
nginx -s reload
For websites hosted on Apache servers, follow similar steps to modify the LimitRequestBody parameter’s value in the httpd.conf file.
After applying these changes, try reuploading files to see if the 413 error is resolved.
How to Avoid the 413 Request Entity Too Large Error
Even though the 413 Request Entity Too Large error may seem harmless, it can significantly harm user experience by interrupting file uploads and form submissions. After troubleshooting the error code, consider these measures to prevent it from recurring:
- Optimize File Sizes: Compressing large files such as images and videos before uploading helps reduce the chances of exceeding server size limits. Utilize image optimization techniques like lossy and lossless compression, and install plugins like WP Smush to automate this process.
- Audit Server Settings Regularly: When adding new functions that send large requests, adjust your server’s configuration settings to handle them effectively. Testing new features in a WordPress staging environment can help prevent errors from affecting your live site.
- Enable Chunked Uploads: Chunked uploading breaks a file into smaller parts, allowing the server to manage large files better. Consider using a WordPress file upload plugin like Big File Uploads to enable this feature.
- Use a Content Delivery Network (CDN): A CDN can offload traffic by caching and serving content from global servers. This reduces server load and minimizes errors related to large requests. Our WordPress Business hosting plans include a free CDN that optimizes website performance.
Call to Action
If you’re still facing challenges with the 413 Request Entity Too Large error in WordPress, don’t hesitate to reach out to Hostinger for expert support and reliable hosting solutions!
Conclusion
The 413 Request Entity Too Large error occurs when the client sends a request larger than the web server’s file upload limit. If unresolved, it can negatively impact user experience and search engine rankings over time.
To recap, here are five effective methods to fix this error code in WordPress:
- Reset file permissions.
- Increase the PHP upload size limit via hPanel.
- Modify the functions.php file.
- Add new rules to the .htaccess file.
- Adjust the NGINX configuration.
We hope this article helps you troubleshoot the 413 error and prevent it from happening again. If you have any questions, feel free to check out the FAQ section below or drop a comment!
413 Request Entity Too Large FAQ
What are the causes of the 413 Request Entity Too Large error?
Uploading files or sending data that exceed the server’s upload size limits causes the 413 Request Entity Too Large error. Incorrect file permissions, insufficient server resources, or incorrect server configuration can also trigger this HTTP error code.
Is there a file size limit that triggers the 413 Request Entity Too Large error?
Yes, the 413 Request Entity Too Large error occurs when a file or request exceeds the server’s size limit. The maximum file upload size limit varies depending on the web host but is usually around 128 MB by default.
Do I have to reduce my file size to avoid the 413 Request Entity Too Large error?
Not necessarily, as you can raise the server’s maximum file upload size limits instead. However, reducing file size is another effective way to avoid the 413 Request Entity Too Large error.
👉 Start your website with Hostinger – get fast, secure hosting here 👈
🔗 Read more from MinimaDesk:
- How to Disable xmlrpc.php in WordPress: A Step-by-Step Guide
- Mastering the WP-Content Directory in WordPress
- The Ultimate Guide to WP-Content: Access, Upload, and Hide Your WordPress Directory
- How Many WordPress Plugins Are Too Many? Optimize Your Site for Success
🎁 Download free premium WordPress tools from our Starter Tools page.