【发布时间】:2021-10-07 02:30:18
【问题描述】:
有一个类似的question here,但我仍然需要在我的网址中包含public 文件夹。
当前网址:https://my-domain.com/api/public/pins
我想要的:https://my-domain.com/api/pins
这是我的项目结构
如您所见,我有 2 个 .htaccess 文件,我应该在哪里以及编写一个 .htaccess 脚本来重定向 public 文件夹?
.htaccess 在public 文件夹中
# Redirect to front controller
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
.htaccess 在root 文件夹中
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
【问题讨论】: