Laravel重写规则

时间:2014-03-19 17:02:33

标签: .htaccess laravel laravel-4

我有.htaccess

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^wniosek.html$ index.php/wniosek [L]

我的routes.php看起来像这样:

Route::resource('/', 'HomeController@showIndex');
Route::resource('/wniosek', 'HomeController@showTest');

在我转到example.com/wniosek.html后,我得到了:

NotFoundHttpException;

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

如果您能够访问此网址:

http:://youdomain.com/wniosek

然后您的规则应该包含整个网址并将其发送到/wniosek

RewriteRule ^(.*)/wniosek.html$ /wniosek [L]