尝试将domain.com/abcd转发到某个不同的本地子文件夹

发布于 2025-01-06 00:59:49 字数 846 浏览 3 评论 0原文

在 apache 服务器安装中,我有一个 .conf 文件,它将所有请求从 www.domain.com 转发到 c:\www\domain。现在,我尝试将 www.domain.com/abcd 转发到本地的另一个子文件夹(例如 c:\www\abcd)。我尝试添加另一个 .conf ,如下所示。

    <VirtualHost *:80>
        ServerName www.domain.com/abcd
        DocumentRoot "c:/www/abcd"

        ErrorDocument   404 /404.php
        ErrorLog "C:/logs/error.log"
        CustomLog "d:/logs/access.log" common

        <Directory "c:/www/abcd">
                RewriteEngine on
                AllowOverride All
        </Directory>

        <Location />
          Order deny,allow
          Deny from all
          Allow from all
        </Location>
 </VirtualHost>

这并没有按预期工作。当我访问 www.domain.com/abcd 时,我猜它试图访问 c:\www\domain\abcd 并显示未找到错误。有没有办法在不创建 DNS 条目且不更改本地主机文件的情况下解决此问题

In the apache server installation I have a .conf file which forwards all requests from www.domain.com to c:\www\domain. Now, i'm trying to forward www.domain.com/abcd to a different subfolder locally (say c:\www\abcd). i tried adding another .conf which looked like this.

    <VirtualHost *:80>
        ServerName www.domain.com/abcd
        DocumentRoot "c:/www/abcd"

        ErrorDocument   404 /404.php
        ErrorLog "C:/logs/error.log"
        CustomLog "d:/logs/access.log" common

        <Directory "c:/www/abcd">
                RewriteEngine on
                AllowOverride All
        </Directory>

        <Location />
          Order deny,allow
          Deny from all
          Allow from all
        </Location>
 </VirtualHost>

This doesn't work as intended. When i go to www.domain.com/abcd , I guess its trying to access c:\www\domain\abcd and showing not found error. Is there anyway to solve this issue without making DNS entries and without making changes to your local hosts file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野稚 2025-01-13 00:59:49

一种可能的解决方案是创建符号链接

mklink /D C:\www\domain\abcd C:\www\abcd

One possible solution would be to make a symbolic link

mklink /D C:\www\domain\abcd C:\www\abcd
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文