更改Laravel 5.1的公用文件夹 [英] Change the public folder of Laravel 5.1
问题描述
我一直在寻找一种方法来更改laravel 5.1中公共文件夹的名称,因为主机只允许我使用htdocs文件夹.
I was looking for a way to change the public's folder name in laravel 5.1, since my host only allows me to use a htdocs folder.
推荐答案
I followed these steps, mentioned here : https://laracasts.com/discuss/channels/general-discussion/where-do-you-set-public-directory-laravel-5 :
-
在
bootstrap/app.php
中,添加
$app->bind('path.public', function() {
return base_path('htdocs');
});
然后在/server.php
中,将public
的两次出现更改为htdocs
(或您要使用的任何内容).
Then, in /server.php
, change the two occurences of public
to htdocs
(Or whatever you wan to use).
我衷心希望在任何情况下都能奏效.
I sincerely hope that'll work in every situation.
我最近不得不做同样的事情,但是这次我的主机允许我删除"htdocs"文件夹(并且我具有ssh访问权限):
I recently had to do the same, but this time my host allowed me to delete the "htdocs" folder (And I had a ssh access) :
- 我将Laravel安装在"htdocs"文件夹下方的根文件夹中
- 我删除了"htdocs"文件夹
- 我创建了一个符号链接,将"htdocs"映射到"public":
ln -s public htdocs
这篇关于更改Laravel 5.1的公用文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!