我为Laravel应用程序创建了一个子域,并将其部署在其上。 (例如:sub.domain.com)
[当我尝试访问sub.domain.com
时,我得到了A 403 Error
,因为未找到index.php并将其位于项目的public /文件夹中。我知道我可以从公用文件夹中移走所有文件并将它们放在项目的根目录中,但这是实现此目的的唯一方法吗?我也尝试创建一个符号链接,但这对我也不起作用。
是否有针对此问题的“ Laravel解决方案? (我正在使用Laravel Framework 7.12.0
)
RewriteEngine on
RewriteBase /
# Rewrites all URLS [Replace "example" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(sub\.)?example\.
# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /public/$1 [L]
这取决于您的子域首先指向的位置。如果它不在您的主域中,则无法将其重定向htaccess