本文介绍了Laravel 7.x-如何从URL中删除“公开"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

坚持了很长时间.我发现了类似的问题,但没有一个答案对我有用!根文件夹中的.htaccess如下所示:

Stuck with this for a long time. I found similar questions but none of the answers are working for me!.htaccess in root folder looks like this:

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

推荐答案

在根目录中创建一个名为".htaccess"的文件,并添加以下代码.就这样

Create a file named as '.htaccess' in root and add the below code. That's it

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]

RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php

这篇关于Laravel 7.x-如何从URL中删除“公开"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 17:26