Apache没有为Laravel正确路由

Apache没有为Laravel正确路由,laravel,laravel-routing,Laravel,Laravel Routing,我已将Laravel的index.php从/public移动到/public/api。现在,如果我想访问它,我还必须在URL中键入index.php 例如,要访问资源,我必须键入localhost/api/index.php/resource,否则会出现404错误 有人能帮忙吗?.htaccess在我朋友运行MAC电脑的电脑上工作正常,但在我的Windows 8电脑上不工作: <IfModule mod_rewrite.c> RewriteEngine On Rewr

我已将
Laravel
index.php
/public
移动到
/public/api
。现在,如果我想访问它,我还必须在
URL
中键入
index.php

例如,要访问资源,我必须键入
localhost/api/index.php/resource
,否则会出现
404错误

有人能帮忙吗?
.htaccess
在我朋友运行MAC电脑的电脑上工作正常,但在我的Windows 8电脑上不工作:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /api/
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

重新启动发动机
重写BASE/api/
选项-多视图
#重定向尾部斜杠。。。
重写规则^(.*)/$/$1[L,R=301]
#处理前控制器。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]
重写规则^(.*)$index.php/$1[L]

我强烈建议您不要这样做,因为我看不出您有任何理由更改index.php文件的位置。在制作应用程序时,您可能还会遇到其他问题。因此,您需要修改index.php文件以包含以下行。请注意额外的../因为您已将其向上移动了一个目录

require __DIR__ . '/../../bootstrap/autoload.php';

$app = require_once __DIR__ . '/../../bootstrap/start.php';
还要确保.htacess文件与index.php文件放在同一文件夹中

我还应该注意到,您根本不必为此修改.htacess文件。移除

RewriteBase /api/

你为什么要移动index.php?我正在使用基本文件夹运行我的AngularJS前端