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

问题描述 投票:0回答:1

我目前正在使用laravel 6,并且尝试在Apache / 2.4.29(Ubuntu)Server中部署我的项目,它的欢迎页面可以正常工作,但是当我尝试登录时,它会显示消息“请求的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看起来像这样允许全部覆盖要求所有授予要求所有授予

而且我已经在apache中启用了我的重写模式,有人可以告诉我如何解决此问题吗?请

php laravel web
1个回答
0
投票

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

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

来源:How to Remove “public/index.php” from URL in Laravel

© www.soinside.com 2019 - 2024. All rights reserved.