Error “request exceeded the limit of 10 internal redirects” in Ubuntu

I’ve just setup a new VPS, and I get this weird error when trying to handle an image that the user uploads that is larger then around 3MB. There’s nothing in the logs except:

request exceeded the limit of 10 internal redirects

Read More

So I started digging around and added everything I could find to my Htaccess with no luck. Maybe it’s something with my new VPS configuration? I’m new at server management so maybe I missed a module or something? maybe I have to make internal redirects bigger?

I’ve set up my LAMP stack with VESTA panel which installs apache2 server with back ngnix support.

This is my .htaccess file:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ ./wedding.php?w=$1


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Thanks! and happy holidays 🙂

Related posts

Leave a Reply

2 comments

  1. RewriteCond %{ENV:REDIRECT_STATUS} ^$
    

    in the .htaccess prevents infinite looping, by checking an internal variable REDIRECT_STATUS. There is an infinite loop somewhere, or a redirect loop potential enough to slow down your web page drastically. I suggest you comment this line and see what happens. If the redirect loop is infinite, it will error out in browser. If not, the page will load, but will take a good amount of time.

    Also I suggest to enable rewrite logs. Adding the following inside your vhost entry in apache config file, and reloading the server would enable rewrite log. That can give a clue, which rewrite log is giving you trouble.

        RewriteLog "logsrewritelog.txt"
        RewriteLogLevel 3
    
  2. The problem was somewhere else entirely!

    My php.ini file had a:

    upload_max_filesize = 2M
    

    If you have this problem make sure these two values are correct for your needs:

    Maximum allowed size for uploaded files.
    upload_max_filesize = 40M
    ; Must be greater than or equal to upload_max_filesize
    post_max_size = 40M