Search Our Database

How to change max upload limit with .htaccess

Last updated on |
by

Introduction

This guide is designed for web administrators or developers looking to increase the maximum file upload size for their website, particularly when hosted on Apache web servers using .htaccess. This is necessary when the default upload limit set by the server is insufficient for larger files such as media or backups. By adjusting the .htaccess file, you can easily control the upload size and ensure that your website operates smoothly without upload restrictions. This solution is applicable to Apache servers that allow the use of .htaccess files and should be implemented with caution.

Prerequisites

  • Access to the root directory of your website.
  • Basic knowledge of .htaccess file configuration.
  • Text editor or file manager with the ability to edit .htaccess files.

1. Locate your .htaccess file

  • Navigate to the root directory of your website
  • This is typically the folder named public_html, wwwroot, or httpdocs
Important Note: If the .htaccess file doesn’t exist, create a new one in the root directory.

 

2. Open the .htaccess file for editing using such as Notepad or any text editor

 

3. Add the upload size limit configuration

You can adjust the 64M value based on your requirements, where M represents Megabytes.

  • To modify the maximum file upload size, insert the following code at the bottom of the .htaccess file:
php_value upload_max_filesize 64M
php_value post_max_size 64M
Important Note: Ensure the upload_max_filesize and post_max_size values are the same or adjusted appropriately.
After done the changes, save the .htaccess file

 

4. Test your changes

  • To verify that the changes are applied, try uploading a file that exceeds the previous limit but falls within the new limit set in the .htaccess file.
  • If the upload is successful, the changes were applied correctly. If you encounter errors, double-check the syntax of the code in your .htaccess file and make sure the server supports .htaccess overrides.

 

Conclusion

By following these steps, you can successfully change the maximum upload file size limit for your website using the .htaccess file. This simple method allows you to control your server’s file upload limits, ensuring a smoother operation for sites handling larger files. If you encounter any issues or need further assistance, refer to your hosting provider’s documentation or contact support.

For additional assistance or if you encounter any issues, please contact our support team at support@ipserverone.com.