Apache Lounge


About Forum Index Downloads Search Register Log in  RSS Apache Lounge  

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.

Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: htaccess MaxRedirects

Joined: 13 Jan 2020
Posts: 3

PostPosted: Mon 13 Jan '20 13:40    Post subject: htaccess MaxRedirects Reply with quote

On a clients web hosting server I was seeing thousands of messages per day in /var/log/apache2/error_log for:

[rewrite:warn] [pid 9535] AH00664: RewriteOptions: MaxRedirects option has been removed in favor of the global LimitInternalRecursion directive and will be ignored.

I took a look in the .htaccess files for each website, and commented out the line which said RewriteOptions MaxRedirects=10, and this stopped the messages. I feel though that this is just hiding the symptoms of the problem, and indeed the client has asked why there are so many redirects in the first place.

On a test environment I slowly stripped out everything from the htaccess file and refreshed the site, with about 5 MaxRedirects errors being generated each time. Eventually I got down to just the RewriteOptions MaxRedirects=10 line itself. I wonder then, does that mean this line itself is actually causing the redirects? I also tried increasing the number from 10 to ridiculous numbers like 100000000000, but still no joy. I also deactivated all plugins (Wordpress) to no avail.

I am looking to understand what is happening here and why these redirects are happening so frequently? Also, what does it mean for server or website performance?
Back to top

Joined: 27 Jun 2016
Posts: 117
Location: Schömberg, Baden-Württemberg, Germany

PostPosted: Tue 14 Jan '20 9:21    Post subject: Reply with quote


the error-message is not about to many redirects but about using an outdated config-line "RewriteOptions MaxRedirects=10" to limit the possible number of redirects.

If you need a limitation of Apache's internal redirects you may remove this line and have a look at its successor: https://httpd.apache.org/docs/2.4/en/mod/core.html#limitinternalrecursion

Best regards
Back to top

Joined: 13 Jan 2020
Posts: 3

PostPosted: Sun 19 Jan '20 0:09    Post subject: Reply with quote

Hi Matthias

I tested the new line in my htaccess file, RewriteOptions LimitInternalRecursion 10, and get a 500 Internal Server Error message. In the error log I get a message, RewriteOptions: unknown option 'LimitInternalRecursion'.

I tried removing the RewriteOptions word, as it is not mentioned in the link you provided, and get a 500 Internal Server page when refreshing the site, and the error message of LimitInternalRecursion not allowed here.

If I write it as RewriteCond LimitInternalRecursion 10, then the site comes up as expected with no error messages, but I'm not sure if this syntax is correct, or if the line is doing what it should. Is there a way I can test it?

I understand that previous site admins added the original line in to stop in to stop crazy numbers of redirects turning "page not found" issues into a 60 second wait for the timeout (years ago), so I want to know how to respond to such a problem if it were to happen again.

Many thanks
Back to top
James Blond

Joined: 19 Jan 2006
Posts: 6861
Location: Germany, Next to Hamburg

PostPosted: Mon 20 Jan '20 9:51    Post subject: Reply with quote

LimitInternalRecursion is not a rewrite Option itself.

see https://httpd.apache.org/docs/2.4/de/mod/core.html#limitinternalrecursion
Back to top

Reply to topic   Topic: htaccess MaxRedirects View previous topic :: View next topic
Post new topic   Forum Index -> Apache