xampp 下更改DocumentRoot 和新建虚拟目录

本文详细介绍了如何更改XAMPP中默认的DocumentRoot路径,通过简单的步骤将默认的htdocs目录更改为自定义路径,并确保更改后能够正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

xampp 安装后,默认的 DocumentRoot 是安装目录下的 htdocs 目录,编程时有很多不便

废话不多说,下面就给你献上方法,本人操作了之后更改成功的

第一步:打开xampp,找到Manage Servers,点击

WechatIMG74.jpeg

第二步:点击Apache Web Server ,点击其对应的Configure
WechatIMG70.jpeg

第三步:点击Open Conf File
WechatIMG72.jpeg

第四步:搜索“htdocs“,跳到如下图并对应更改
WechatIMG73.jpeg
当然这么多代码不会让你敲拉,复制下面的就可以了

DocumentRoot "E:/project/php"//更改为你想要的路径
<Directory "E:/project/php">
    #
    # 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.4/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:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

别忘了最后一步哦
更改以上设置后,必须重启 xmapp才能使设置生效

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值