【发布时间】:2019-08-03 19:01:08
【问题描述】:
喂! 我正在使用 laravel 5.8,当我在我的 url 中输入错误的地址时,它会给出错误
Trying to get property of non-object (View: C:\xampp\htdocs\cms\resources\views\post.blade.php)
网址喜欢
http://127.0.0.1:8000/lkfajds;
这是我输入的错误网址。
为什么这不让我回到 404 页面我该怎么做呢
想要:我想将我重定向到 404 页面
这里是htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
【问题讨论】:
标签: laravel .htaccess laravel-5