相关疑难解决方法(0)

Laravel Routes不工作,Apache配置只允许public/index.php/route

例:

Route::get('/get', function() {
    return 'get';
});
Run Code Online (Sandbox Code Playgroud)

要查看上面的路由,我必须导航到public/index.php/get.

我已经查看了很多SO帖子,并搜索了不同的东西,并没有产生任何影响(是的,我每次都重启apache).

这是我在公共目录中的.htaccess:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
</IfModule>

# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

还有什么可能导致这种情况?我正在运行Ubuntu.

apache .htaccess laravel

20
推荐指数
4
解决办法
5万
查看次数

标签 统计

.htaccess ×1

apache ×1

laravel ×1