Php 我能';t通过.htaccess在重定向的URL中隐藏子文件夹

Php 我能';t通过.htaccess在重定向的URL中隐藏子文件夹,php,.htaccess,mod-rewrite,redirect,Php,.htaccess,Mod Rewrite,Redirect,我在这里看到了一些解决方案,但它们对我没有帮助。 我的index.php在这里:http://localhost/basic-2/web/index.php 如果我输入http://localhost/basic-2,浏览器将我重定向到http://localhost/basic-2/web/index.phppath,但在浏览器中,URL必须是http://localhost/basic-2/index.php地址。 因此,我想从URL中删除(或隐藏)web子文件夹 RewriteEngine

我在这里看到了一些解决方案,但它们对我没有帮助。 我的index.php在这里:
http://localhost/basic-2/web/index.php

如果我输入
http://localhost/basic-2
,浏览器将我重定向到
http://localhost/basic-2/web/index.php
path,但在浏览器中,URL必须是
http://localhost/basic-2/index.php
地址。 因此,我想从URL中删除(或隐藏)
web
子文件夹

RewriteEngine On
RewriteRule ^$ web [L]
我在这里看到了很多解决方案。。。但是没有:(,现在我有了这个:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/web/$1 -f [NC]
RewriteRule ^([^/]+)$ /web/$1 [P,L,QSA]
但这只是列出文件夹和文件…而不是重定向到子文件夹

这可以重定向,但不会从URL中隐藏
web
文件夹

RewriteEngine On
RewriteRule ^$ web [L]
Edit1 我发现了另一条规则:

RewriteEngine On
RewriteRule ^$ web/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ web/$1
这可以重定向!但此规则不会隐藏(或删除)
web
文件夹…

请尝试以下操作:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /basic-2/

RewriteCond %{DOCUMENT_ROOT}/basic-2/web/$1 -f [NC]
RewriteRule ^(.*)$ web/$1 [P,L,QSA]

RewriteCond %{THE_REQUEST} \ /basic-2/web/([^\?\ ]*)
RewriteRule ^ /basic-2/%1 [L,R=301]

这些规则在哪里?在
basic-2
文件夹中?是的,规则(the.htaccess)在
basic-2
文件夹中:)否,这给了我以下错误:未找到
此服务器上未找到请求的URL/basic-2/index.php