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