How to Increase Max URL Length in Apache

Last updated on August 10th, 2020 at 03:05 am

By default, Apache’s maximum URL length is 8177 characters, which is good for most websites. However, if you want to increase max URL length in Apache to support long URLs, then here are the steps to do it.

 

How to Increase Max URL Length in Apache

Apache’s default URL length of 8177 characters is sufficient for most websites. However, if your requests exceed this limit, then Apache will throw a “Request-URI too large” error. To fix this problem, we will increase the max URL length in Apache.

Here are the steps to increase max URL length in Apache using LimitRequestLine directive. You can use these steps to increase max URL length in Apache in Ubuntu/Debian systems as well as CentOS/Redhat/Fedora Linux.

 

1. Open Apache configuration file

Open Apache configuration file in a text editor. You will find the Apache server configuration file located at one of the following locations, depending on your installation.

  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/httpd.conf
  • /etc/httpd/conf/httpd.conf

 

$ sudo vi /etc/apache2/apache2.conf

 

Bonus Read : How to Increase Max Connections in Apache

 

2. Increase Max URL length in Apache

We will use the LimitRequestLine directive to increase max URL length. Here’s the syntax of

LimitRequestLine NumberOfBytes

In the above directive, you need to specify NumberOfBytes as the new max url length for Apache.

If you want to increase max URL length in Apache to 100000 characters, just add the following line to your Apache server configuration file.

LimitRequestLine 100000

 

Bonus Read : How to Configure Apache Load Balancer

 

3. Restart Apache Web Server

Restart Apache server to apply changes.

Ubuntu/Debian

$ sudo service apache2 restart

CentOS/Redhat/Fedora

$ sudo service httpd restart

Bonus Read : Apache Reverse Proxy Configuration

 

 

Ubiq makes it easy to visualize data in minutes, and monitor in real-time dashboards. Try it Today!