请帮助我,我正在使用最新版本的 xampp 开发 Laravel,并且不知道问题的原因是什么。
这条路线运行良好:
Route::get('/', function () {
return 'aa';
});
此路线给出错误“未找到对象!”:
Route::get('about', function () {
return 'aaa';
});
httpd.vhosts:
<VirtualHost test.loc:80>
DocumentRoot "C:/xampp/apps/test.loc/public"
ServerName test.loc
<Directory "C:/xampp/apps/test.loc/public">
#AllowOverride All - when I use this, I get a "Access forbidden!" for all routes
Require all granted - this works for the main route, other routes give "errors".
</Directory>
/public/.htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
我面临着完全相同的问题,但最终这对我有用。
.....
<Directory "C:/xampp/apps/test.loc/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)