web目录是应用程序的所有公共和静态文件的主目录。包括图像、样式表和JavaScript文件。它也是前端控制器所在的位置。
所以问题是,当我安装和设置xampp时,我的web目录是:
xampp\htdocs
我想把它设置为:
xampp\htdocs\myproject\web
该怎么做呢?现在,当我在浏览器中输入地址:http://localhost/
我进入xampp\htdocs
目录
我想在我的浏览器里输入地址:http://localhost/
并进入xampp\htdocs\myproject\web
目录
发布于 2016-06-26 10:38:19
以防万一,如果任何人喜欢更简单的解决方案,特别是在Linux (例如Ubuntu)上,一个非常简单的方法是在htdocs文件夹中创建一个指向目标文件夹的符号链接。例如,如果我希望能够提供名为“/home/home/projects/testserver/”的文件夹中的文件,而我的htdocs位于"/opt/lampp/htdocs/“中。只需创建一个符号链接,如下所示:
ln -s /home/some/projects/testserver /opt/lampp/htdocs/testserver
符号链接的命令是这样工作的:ln -s target source
其中,
target - The existing file/directory you would like to link TO.
source - The file/folder to be created, copying the contents of the target. The LINK itself.
有关更多帮助,请参阅ln --help来源:Create Symbolic Links in Ubuntu
这就完成了。只需访问http://localhost/testserver/实际上,您甚至不需要重新启动服务器。
发布于 2016-01-29 04:38:59
我没有编辑Apache配置文件(httpd.conf),而是将htdocs文件夹从C:\xampp\htdocs移到了D:\htdocs。
步骤1)将C:\xampp\htdocs
文件夹移动到D:\htdocs
。步骤2)使用mklink命令在C:\xampp\htdocs中创建一个链接到D:\htdocs的符号链接。
D:\>mklink /J C:\xampp\htdocs D:\htdocs
Junction created for C:\xampp\htdocs <<===>> D:\htdocs
D:\>
步骤3)完成!
发布于 2017-12-03 19:21:34
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
将上述代码写在以下标记中< Directory "c:\projects“>c:(您可以添加任何目录d: e:)是您创建项目文件夹的驱动器。
别名项目“c:\ /projects”
现在,您可以在浏览器上访问pr0jects目录:
localhost/projects/
https://stackoverflow.com/questions/18902887
复制