当尝试使用laravel路由系统时,没有找到404


404 not found when trying to use laravel routing sytem

我有这个在routes.php:

Route::get('/', array('as' => 'home', function()
{
    return View::make('home');
}));
Route::get('/releases', 'ReleasesController@index');

app/controllers/ReleasesController.php中,我有这个:

class ReleasesController extends BaseController {
    public function index()
    {
        $releases = Releases::paginate(3);
        return View::make('Releases.list', array('releases' => $releases));    }
}

最后在app/views/Releases/list.blade.php我有渲染模板。

我试图用/test而不是/修改家庭路线,也不工作。似乎我只能有根路径(又名。/)。希望有人能帮助我。

。似乎我只能有根路径(又名。/)。希望有人能帮助我。

你的问题有点缺乏细节,但听起来你可能没有mod_rewrite(或其nginx等效)设置与你的web服务器。而不是

http://example.com/releases

试试URL

http://example.com/index.php/releases

我猜第二种形式的url工作正确。在启用了重写模块的web服务器上,web服务器将自动打开

http://example.com/releases

http://example.com/index.php/releases

在幕后。要么在你的web服务器上启用重写,要么接受包含index.php的url

如果使用IIS作为web服务器,创建一个名为web的文件。在公共文件夹或index.php所在的地方配置如下配置:

<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>