Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' drupal code example

Example 1: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary

Inside /etc/apache2/apache2.conf Replace

<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted
to
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted

and

<Directory /usr/share> AllowOverride None Require all granted
to
<Directory /usr/share> AllowOverride All Require all granted

Run these commands

sudo a2enmod rewrite
sudo service apache2 restart

Inside your .htaccess file

DirectoryIndex index.php

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]

    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]

    RewriteRule .? %{ENV:BASE}/index.php [L]

</IfModule>

Example 2: request exceeded the limit of 10 internal redirects due to probable configuration error

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');