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  Easy Create Laravel Project with Composer

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.

Centos Failed Update Kernel

Today I did a kernel update on my server with Centos 7 OS. At the end of the update process, I found a kernel...
habibzain
1 min read

Easy Fix Missing mirrorlist http://mirrorlist.centos.org on CentOS 7

When running yum update or command that utilize the yum system, errors similar to the following are produced: If you’re encountering issues with the...
habibzain
1 min read

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

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