更新时间:2022-11-04 20:41:39
您将按照在根目录中安装它的相同方式进行操作.我将告诉您如何将其安装在共享托管帐户(主域和子域)上.将所有项目上传到子文件夹后,您将成为example.com/ru
,请执行以下操作:
You will do it in the same way you installed it in the root directory. I will tell you how I installed it on my shared hosting account, both main and sub domains. After I uploaded all my project to the subfolder, and your will be example.com/ru
, do the following:
.htaccess
文件.由于您基本上是将其作为子域,因此它必须位于该子域的根目录中,因此请将.htaccess
从公用文件夹传输到ru
文件夹的根目录.打开.htaccess
并更改/添加以下内容:
.htaccess
file. since you are basically making this a subdomain, it will need to be in the root of that subdomain, so transfer the .htaccess
from public folder to the root of ru
folder.Open the .htaccess
and change/add the following:
DirectoryIndex public/index.php
,然后在RewriteRule
中将其更改为此:
and in the RewriteRule
change it to this:
public/index.php
请注意,更改后的.htaccess
应该像这样:
And just to be clear, your .htaccess
should be like this at the end after your changes:
DirectoryIndex public/index.php
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>