Laravel 通过 10 次重定向发送服务器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16885467/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 07:52:00  来源:igfitidea点击:

Laravel sends the server on 10 redirects?

apachemod-rewritelaravellaravel-4

提问by user1797484

Getting error message:

获取错误信息:

[Sun Jun 02 12:43:33.579095 2013] [core:error] [pid 4964:tid 808] [client 127.0.0.1:56964] 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 

When trying to use laravel to do routing. My routes are as follows:

尝试使用 Laravel 进行路由时。我的路线如下:

Route::get('/', 'HomeController@showWelcome');
Route::get('history', 'HistoryController@showHistory');

And my .htaccess:

还有我的 .htaccess:

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

And my alias:

还有我的别名:

Alias /wunhopkuendo/ "c:/wamp/www/wunhopkuendo/public/" 

<Directory "c:/wamp/www/wunhopkuendo/public/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
</Directory>

回答by Sam Texas

I had this problem as well, and I solved it with the following line on the .htaccessfile:

我也有这个问题,我用.htaccess文件中的以下行解决了它:

RewriteBase /

回答by Rodrigo Saraiva

If you are using Laravel in a subfolder, you need to follow this steps:

如果在子文件夹中使用 Laravel,则需要执行以下步骤:

* Consider that you uses WAMP on default instalation directory (c:\wamp)

* 考虑您在默认安装目录 (c:\wamp) 上使用 WAMP

Insert the RewriteBase line in your .htaccess file with the subfolder of your Laravel instalation.

在 Laravel 安装的子文件夹中的 .htaccess 文件中插入 RewriteBase 行。

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /subfolder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
<IfModule>

<IfModule mod_rewrite.c>
选项 -MultiViews
RewriteEngine On
RewriteBase /subfolder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
<IfModule>

Set the application URL on file c:\wamp\www\subfolder\config\app.php

在文件 c:\wamp\www\subfolder\config\app.php 上设置应用程序 URL

'url' => 'hggp://localhost/subfolder',

'url' => 'hggp://localhost/subfolder',

Create a configuration file on alias directory c:\wamp\alias\subfolder.conf with this content:

在别名目录 c:\wamp\alias\subfolder.conf 上创建一个配置文件,内容如下:

Alias /subfolder"c:/wamp/www/testando/public"

<Directory "c:/wamp/www/subfolder/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Allow from all
</Directory>

别名 /subfolder"c:/wamp/www/testando/public"

<Directory "c:/wamp/www/subfolder/public">
选项索引 FollowSymLinks MultiViews
AllowOverride all
Allow from all
</Directory>

This it works! :)

这是它的工作原理!:)