【问题标题】:Unable to handle 404 error outside laravel and angularjs无法在 laravel 和 angularjs 之外处理 404 错误
【发布时间】:2015-06-12 22:07:44
【问题描述】:

我在将 404 错误重定向到自定义模板时遇到问题。

我的站点结构是:包含 laravel 和 angularjs 文件夹的项目文件夹:

-> 项目

 -> AngularTheme
 -> Laravel

在我的.htaccess 中,我已将来自/ 的请求重定向到/AngularTheme/index.php,这工作正常。

RewriteRule ^(/)?$ ./AngularTheme/index.php [L]

现在,当有人在/ 之后输入任何内容时,即/foo 它会抛出 404 not found 错误,我无法处理

在 laravel 和 Angular 中,重定向到客户页面没有任何问题。

感谢您的帮助。

【问题讨论】:

    标签: php angularjs .htaccess laravel http-status-code-404


    【解决方案1】:

    我会坚持你所知道的去做。

    here's a guide to do custom 404 handling in laravel

    尽管在某些情况下,您也可以通过路由转入特定页面。

    【讨论】:

    • 谢谢丹尼尔,但这不是解决方案,因为我已经提到在 Laravel 和 AngularJS 中,显示自定义错误页面没有问题。但问题是我的根在两者之外。
    猜你喜欢
    • 2013-07-05
    • 2013-12-08
    • 2016-06-08
    • 2014-07-02
    • 2022-01-05
    • 2011-12-26
    • 1970-01-01
    • 1970-01-01
    • 2016-02-10
    相关资源
    最近更新 更多