【问题标题】:How to point the subdomain to Main domain sub folder如何将子域指向主域子文件夹
【发布时间】:2016-12-19 00:55:57
【问题描述】:

我有站点 domain.com 并创建了需要 subdomain.domain.com 指向目录 domain.com/public_html/subdomain

我该怎么做?

subdomain 文件夹必须在 public_html 文件夹 domain.com

vestaCP拥有选择subdomain的根文件夹的权限?

对不起,我的英语不好。

简单地说:

我需要它:

sub.domain.com> /home/user/web/domain.com/public_html/subdomain

没有:

sub.domain.com> /home/user/web/sub.domain.com/public_html

【问题讨论】:

    标签: php apache .htaccess vesta


    【解决方案1】:

    我总是通过这两种方法之一来解决它(每种方法都有优点和缺点):

    1. 我通过 .htaccess 文件将子域重定向到主域下的文件夹。所以我只是将Redirect 301 / http://example.com/subfolder 添加到子域的.htaccess 文件中。这是经典的无掩码重定向。
    2. 我在/home/user/web/sub.domain.com/public_html 文件夹中创建了一个PHP 文件index.php,内容为:<?php print file_get_contents("https://example.com/subdomain/"); ?>,文件夹/home/user/web/example.com/public_html/subdomain 是网站。 Phe PHP 文件在主域文件夹中显示网站的全部内容。

    它们都不是真正的解决方案,这只是一个如何破解它,但我希望它会有用

    【讨论】:

      猜你喜欢
      • 2019-02-05
      • 2021-02-06
      • 1970-01-01
      • 2013-11-22
      • 2015-06-23
      • 1970-01-01
      • 2010-12-07
      • 1970-01-01
      • 2017-08-05
      相关资源
      最近更新 更多