【发布时间】:2013-09-07 02:15:49
【问题描述】:
我在 Apache2 上启用了 mod_rewrite,在默认文件中启用了 AllowOverride All。但是,当从 Laravel 给定 pretty url 时,Apache(重新启动后)似乎仍然无法重定向。
WORKS(返回:用户!):localhost/laratest/public/index.php/users
不起作用 (404):localhost/laratest/public/users
我的 .htaccess:(我也尝试了Documentation 中建议的方法,但无济于事)
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Laravel routes.php:
Route::get('/', function()
{
return View::make('hello');
});
Route::get('users', function()
{
return 'Users!';
});
我在 Ubuntu 中使用默认的 LAMP 堆栈和配置。任何想法为什么这不起作用?
【问题讨论】:
标签: apache .htaccess mod-rewrite laravel