【问题标题】:redirecting sub sub domains in a wildcard vhost apache (xampp) setup在通配符 vhost apache (xampp) 设置中重定向子子域
【发布时间】:2020-04-17 00:38:45
【问题描述】:

我在 Windows 10 上使用 XAMPP 和 Acrylic DNS 代理,我需要每天或每周创建多个应用程序,这些应用程序有时需要从不同的域提供服务,在这种情况下我想使用子域。

我正在尝试从域 (app1.jml => c:/apps/app1) 中的 apache 文件夹中提供多个应用程序,到目前为止我已经完成了这项工作。

但我想将子域重定向到同一个域(sub1.app1.jml => c:/apps/app1),然后让我的应用程序(php/mysql)处理请求。

基本上:

app1.jml             -> c:/apps/app1    (1)
sub1.app1.jml        -> c:/apps/app1    (2)
sub2.app1.jml        -> c:/apps/app1    (2)

app2.jml             -> c:/apps/app2    (1)
sub1.app2.jml        -> c:/apps/app2    (2)
sub2.app2.jml        -> c:/apps/app2    (2)

我得到 (1) 使用以下虚拟主机配置:

<VirtualHost *:80>
    ServerAlias *.jml
    VirtualDocumentRoot c:/apps/%1/

    <Directory "c:/sites/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

但我无法获得 (2)。我尝试了以下代码:


<VirtualHost *:80>
    ServerAlias *.jml
    VirtualDocumentRoot c:/sites/%1/

    <Directory "c:/sites/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAlias *.*.jml
    VirtualDocumentRoot c:/sites/%1/

    <Directory "c:/sites/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

它没有用,它给了我这个:

app1.jml             -> c:/apps/app1
sub1.app1.jml        -> c:/apps/sub1
app1.app1.jml        -> c:/apps/app1

对于ServerAlias *.*.jml,我尝试了VirtualDocumentRoot中的所有(%2, %0, %-1, %-2),但无济于事。

我错过了什么吗? 谢谢你的帮助:-)

【问题讨论】:

    标签: apache xampp subdomain virtualhost wildcard-subdomain


    【解决方案1】:

    我也在 Apache Friends Support Forum 得到回复说我的两条规则冲突,所以我修复了我的配置的第一部分并删除了第二部分:

    <VirtualHost *:80>
        ServerAlias *.jml
        VirtualDocumentRoot c:/sites/%-2/
    
       <Directory "c:/sites/">
          Options +Indexes +Includes +FollowSymLinks +MultiViews
          AllowOverride All
          Require all granted
       </Directory>
    </VirtualHost>
    

    【讨论】:

    • 您对 xampp 上的哪些文件进行了此更改?
    猜你喜欢
    • 2013-07-13
    • 2017-06-23
    • 2018-05-08
    • 2020-09-27
    • 1970-01-01
    • 2018-08-14
    • 2018-05-12
    • 2014-06-12
    • 2010-11-14
    相关资源
    最近更新 更多