更新时间:2023-11-15 13:09:58
似乎您的Laravel应用可以通过Apache HTTP别名访问,因为您的URL类似于:http://localhost/laravel/
.如果是这种情况,并假设 http://localhost/laravel
指向您的公共目录,请按照下列步骤操作:
Seems like your Laravel app is accesible via an Apache HTTP alias, because your URL looks like: http://localhost/laravel/
. If this is the case and assuming that http://localhost/laravel
is pointing to your public directory, then follow these steps:
/index.php/
之前加上/index.php/
.如果它可以正常工作(否404),则说明您的问题是Apache HTTP的重写模块配置,您应该执行以下步骤.public/.htaccess
.RewriteEngine On
行下添加RewriteBase /laravel/
./index.php/
, in your case: http://localhost/laravel/index.php/users
. If it works (no 404) then you problem is with the Rewrite Module configuration of Apache HTTP, you should follow the next steps.public/.htaccess
.RewriteEngine On
add RewriteBase /laravel/
.基本上,如果您的应用程序位于别名或虚拟目录(例如http://localhost/alias
)中,则应在重写规则中添加一个条目,以使用alias
重写基本目录.
Basically, if you app resides in a alias or virtual directory (say http://localhost/alias
) you should add an entry in your rewrite rule to rewrite the base directory with alias
.