Php htaccess文件在linux上的Laravel中无法正常工作

Php htaccess文件在linux上的Laravel中无法正常工作,php,laravel,.htaccess,Php,Laravel,.htaccess,我在做一个拉威尔的项目。我正在从URL中删除“/public”,但它只在欢迎页面工作,其他页面如/login,/register无法正常工作。它显示了一个错误 在此服务器上找不到请求的URL/GME/登录名 本地主机端口80上的Apache/2.4.18(Ubuntu)服务器 但当我在URL中使用public/index.php时,它就起作用了 这里是我的根目录.htaccess文件代码 <IfModule mod_rewrite.c> RewriteEngine on Rewri

我在做一个拉威尔的项目。我正在从URL中删除“/public”,但它只在
欢迎
页面工作,其他页面如
/login
/register
无法正常工作。它显示了一个错误

在此服务器上找不到请求的URL/GME/登录名

本地主机端口80上的Apache/2.4.18(Ubuntu)服务器

但当我在URL中使用
public/index.php
时,它就起作用了

这里是我的
根目录
.htaccess
文件代码

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public/
RewriteRule ^(.*)$ public/$1 [L] #relative substitution
RewriteRule ^ index.php
<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]

注意:我使用的是linux基本操作系统loki版本


我认为您需要将其添加到GME目录.htaccess中

RewriteEngine On
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

我认为您需要将其添加到GME目录.htaccess中

RewriteEngine On
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

您可以共享您的文件夹结构吗?如
laravel
project文件夹结构。您在哪里设置了
DOCUMENT\u ROOT
?它是公共文件夹吗?还是拉威尔项目的根源?您的文档根目录应该是
public
文件夹。@SakibulAlam我正在更新我的问题,请查看目录结构。您可以共享您的文件夹结构吗?如
laravel
项目文件夹结构。您在哪里设置了
文档根目录
?它是公共文件夹吗?还是拉威尔项目的根源?您的文档根目录应该是
public
文件夹。@SakibulAlam我正在更新我的问题。请查看
root
目录
中的目录结构。htaccess
public/.htaccess
?在
root
目录
中的
public/.htaccess