从 Laravel 部署的项目中删除索引.php



我目前正在使用Laravel 6,我正在尝试在Apache/2.4.29(Ubuntu(服务器中部署我的项目。我的欢迎页面可以工作,但是当我尝试登录时,它显示以下消息:

在此服务器上找不到请求的 URL。

但是当我尝试使用index.php/login登录时,我可以登录并且路由工作正常,但没有 CSS,我的.htacces文件如下所示:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteBase /var/www/apps/hris/imiforms
# 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]
</IfModule>

我在 Apache 中的.conf文件看起来像这样:

<Directory /var/www/apps/hris/imiforms/public>
AllowOverride All
Require all granted
Require all granted
</Directory>

我已经在 Apache 中启用了重写模式。如何解决此问题?

编辑 .htaccess 文件,使其包含以下代码:

<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

来源:如何从Laravel的URL中删除"public/index.php">