【问题标题】:wildcard virtualhost for wordpress multisite用于 wordpress 多站点的通配符虚拟主机
【发布时间】:2018-08-23 20:19:16
【问题描述】:

我正在为我的本地开发环境使用通配符虚拟主机,如下所示:

ServerAlias *.local
VirtualDocumentRoot "c:/dev/sites/%1/www"

这按预期工作。我在站点文件夹中创建了一个新站点,并导航到 newsite.local 加载该站点。问题是我使用了多站点 Wordpress 配置。所以导航到 subsite.newsite.local 不会加载。我认为这是因为 Apache 将寻找文件夹结构:

c:/dev/sites/subsite.newsite/www

而不是指向域目录:

c:/dev/sites/newsite/www

我的问题是,如何编写 virtualhost 指令,使任何子域都指向根域?

例如

site.local -> c:/dev/sites/site/www
subsite.site.local -> c:/dev/sites/site/www
subsite-two.site.local -> c:/dev/sites/site/www

【问题讨论】:

    标签: regex wordpress apache virtualhost spoofing


    【解决方案1】:

    我通过查看 mod_vhost_alias 的文档找到了解决方案 https://httpd.apache.org/docs/2.4/mod/mod_vhost_alias.html

    通过从名称末尾散列:

    ServerAlias *.local
    VirtualDocumentRoot "c:/dev/sites/%-2/www"
    

    【讨论】:

      猜你喜欢
      • 2023-03-28
      • 2012-06-08
      • 2020-11-18
      • 1970-01-01
      • 2019-09-12
      • 2014-07-09
      • 1970-01-01
      • 2014-04-30
      • 1970-01-01
      相关资源
      最近更新 更多