使用 laravel 修复 google 抓取 404 错误

fix google crawl 404 errors with laravel

我最近用 laravel 制作的新网站替换了一个旧网站。现在,如果我检查 google 网站管理员工具,我有一些 404 错误,当然是由于不同的 URI。 昨天我用一个简单的重定向修复了它们,比如

    Route::get('librerie_su_misura/librerie_su_misura.php', function(){ 
    return Redirect::to('librerie-su-misura', 301);
});

但是今天早上我醒来的时候在想 Google 是否可以,或者在

等相同的旧路径上加载页面可能是更好的方法
    Route::get('librerie_su_misura/librerie_su_misura.php', 'LibrerieController@index');

您认为最好的方法是什么?当然,我希望有一天能删除旧路线,你认为第一种方法对 google 可行吗?

根据 RFC2616,section 10.3.2 301 Moved Permanently

The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible.

这也是recommended practice from Google