我已经为两个域 www.domain1.com 和 www.domain2.com 配置了两个虚拟主机:
<VirtualHost *>
ServerName prod.domain.com
ServerAlias www.domain1.com
DocumentRoot /data/prod/web/
DirectoryIndex index.php
<Directory "/data/prod/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /data/prod/lib/vendor/symfony/data/web/sf
<Directory "/data/prod/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</VirtualHost>
<VirtualHost *>
ServerName dev.domain.com
ServerAlias www.domain2.com
DocumentRoot /data/dev/web/
DirectoryIndex index.php
<Directory "/data/dev/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /data/dev/lib/vendor/symfony/data/web/sf
<Directory "/data/dev/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
现在,我想用 htaccess 文件切换指向域的文件夹:
前
/data/prod/web --> www.domain1.com
/data/dev/web --> www.domain2.com
后
/data/prod/web --> www.domain2.com
/data/dev/web --> www.domain1.com
是否可以?你可以帮帮我吗 ?
非常感谢