【问题标题】:How to access my single wordpress site via multiple sub-domain如何通过多个子域访问我的单个 wordpress 站点
【发布时间】:2015-12-06 06:48:27
【问题描述】:

我想通过多个子域访问我的单个 worpress 安装站点,而不使用多站点功能。

我已经尝试过,但我没有找到完美的解决方案:

我使用了 MultiDomain 插件,但它限制了我通过硬代码在数组中添加多个域,实际上我想要子域 ui 插件来帮助我添加多个子域,如“myname.example.com”以在主 wordpress 中重定向网站即“example.com”。

提前致谢

【问题讨论】:

    标签: wordpress


    【解决方案1】:

    您可以使用 NameVirtualHost 在 apache 中轻松配置,无需 WordPress 插件。

    <VirtualHost *:80>
      ServerName *.example.com
      # for a single subdomain:
      #ServerAlias myname.example.com
      Redirect permanent / http://example.com
    </VirtualHost>
    

    如果您没有直接访问您的 apache 配置的权限,您可以将 *.example.com 配置为它自己的文档根目录(如何做到这一点取决于您的主机,不能给您任何具体示例)并配置重定向在.htaccess 文件中:

    RewriteEngine On
    RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
    

    【讨论】:

      猜你喜欢
      • 2014-12-04
      • 1970-01-01
      • 2014-11-07
      • 1970-01-01
      • 2019-03-26
      • 2015-03-04
      • 2021-06-25
      • 1970-01-01
      • 2013-02-22
      相关资源
      最近更新 更多