habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Laravel htaccess Redirect to Sub Folder

1 min read

Today, the story is that there is a Laravel Project setup in ISP Config Hosting, where the default directory data for each client is in /web then index.php is directly indexed, but these Apps are in the /public folder.

key : Error “Request exceeded the limit of 10 internal redirects”

I tried googling, and found it on one of the stackoverflow, then I applied it in htaccess. Here is the code:

RewriteEngine On

# Rewrite static resources
RewriteCond %{DOCUMENT_ROOT}/myProjectDir/public/$1 -f
RewriteRule (.+) myProjectDir/public/$1 [L]

# Rewrite everything else to the "public" directory
RewriteRule .* myProjectDir/public/ [L]

In my project, Laravel‘s data directory is in the “demo” folder, as shown in the image below.

But unfortunately, an error occurred.

[Wed Oct 13 11:56:18.516039 2021] [core:error] [pid 10603:tid 139759234017024] [client 10.200.30.151:51057] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Oct 13 11:56:18.516039 2021] [core:error] [pid 10603:tid 139759234017024] [client 10.200.30.151:51057] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Oct 13 11:56:18.516039 2021] [core:error] [pid 10603:tid 139759234017024] [client 10.200.30.151:51057] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Oct 13 11:56:18.516039 2021] [core:error] [pid 10603:tid 139759234017024] [client 10.200.30.151:51057] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Oct 13 11:56:18.516039 2021] [core:error] [pid 10603:tid 139759234017024] [client 10.200.30.151:51057] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Oct 13 11:56:18.516039 2021] [core:error] [pid 10603:tid 139759234017024] [client 10.200.30.151:51057] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Wed Oct 13 11:56:18.516039 2021] [core:error] [pid 10603:tid 139759234017024] [client 10.200.30.151:51057] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

And then googling again about “Request exceeded the limit of 10 internal redirects”, finally found this article.

See Also: Ispconfig Nginx Directives Laravel

I tried to apply it in my laravel project’s htaccess and it was solved. Here is my code.

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/myprojectDir/public/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ /myProjectDir/public/$1
#RewriteRule ^ index.php [L]
RewriteRule ^(/)?$ myProjectDir/public/index.php [L]

Ok, the problem is solved.

See also  Install Nginx PHP-FPM on Ubuntu 18.04 LTS

habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Easy Create Laravel Project with Composer

Requirement Laravel, a popular PHP framework, is renowned for its elegant syntax and robust features, making it a top choice for web developers. One...
habibzain
1 min read

Virtualbox Change Storage Size

Changing the storage size of a virtual machine in VirtualBox involves a few steps. Here’s a general guide. Backup your Virtual Machine (VM) Before...
habibzain
35 sec read

Easy Setup Logrotate Nginx Ubuntu

Log rotation is an important aspect of managing log files on a Linux system, including those generated by Nginx. Logrotate is a utility that...
habibzain
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

Never miss good article from us, get weekly updates in your inbox