Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
子域仅显示php_Php_Apache_Subdomain - Fatal编程技术网

子域仅显示php

子域仅显示php,php,apache,subdomain,Php,Apache,Subdomain,我想简化*.domain.com中的所有子域,用子域的url显示domain.com的内容。但现在它返回给我的是php源代码,而不是构建的页面。如果使用*.80虚拟主机,则所有都可以工作,但子域显示www目录中的第一个站点,因为两个站点使用相同的ip 我的文件结构 www site1 site2(which content i need to show with subdomains) content subdomain1 subdomain2 index.php 我的虚拟

我想简化*.domain.com中的所有子域,用子域的url显示domain.com的内容。但现在它返回给我的是php源代码,而不是构建的页面。如果使用*.80虚拟主机,则所有都可以工作,但子域显示www目录中的第一个站点,因为两个站点使用相同的ip

我的文件结构

www
 site1
 site2(which content i need to show with subdomains)
  content
  subdomain1
  subdomain2
  index.php
我的虚拟主机在apache2.conf代码中

<VirtualHost IP:PORT>
    ServerName domain.com
    DocumentRoot /var/www/path/data/www/domain.com
    ServerAlias *.domain.com
    RewriteCond %{HTTP_HOST} ^[^.]+\.domain\.com$
    RewriteRule !^index\.php$ index.php [L]
</VirtualHost>
输出

<?php require(dirname(__FILE__).'/config/config.inc.php'); 
Dispatcher::getInstance()->dispatch(); ?>