2012-06-08 78 views
2

我有一个配置了多个虚拟主机的本地开发Debx64机器。 主URL被设定为htaccess虚拟主机不能正常工作

<VirtualHost *:80> 
ServerAdmin [email protected] 
ServerName blah.com 
ServerAlias blah.com 
DocumentRoot /home/blah/v1.blah.com 
<Directory /home/blah/v1.blah.com/> 
      AllowOverride All 
      Order allow,deny 
      allow from all 
</Directory> 
AccessFileName .htaccess 
ErrorLog /home/blah/blah_logs/v1.blah.com.in-error_log 
CustomLog /home/blah/blah_logs/v1.blah.com.in-access_log common 
</VirtualHost> 

和重定向到初级操作VH

<VirtualHost *:80> 
ServerAdmin [email protected] 
ServerName v1.blah.com 
ServerAlias v1.blah.com 
DocumentRoot /home/blah/v1.blah.com 
<Directory /home/blah/v1.blah.com/> 
      AllowOverride All 
      Order allow,deny 
      allow from all 
</Directory> 
AccessFileName .htaccess 
ErrorLog /home/blah/blah_logs/v1.blah.com.in-error_log 
CustomLog /home/blah/blah_logs/v1.blah.com.in-access_log common 
</VirtualHost> 

我有一个htaccess的设置上v1.blah.com解析的.html作为.PHP

Options +ExecCGI 

AddHandler php-fcgi .php .html 
Action php-cgi /home/php5-fcgi 
<FilesMatch "^php5?\.(ini|cgi)$"> 
    Order Deny,Allow 
    Deny from All 
    Allow from env=REDIRECT_STATUS 
</FilesMatch> 

这工作正常,如果我访问的URL为v1.blah.com,但是如果我作为blah.com访问它的.htaccess没有调用和.html作为正常服务。

我失踪了什么?有没有需要改变的php.ini中的东西?

回答

4

为什么你需要为你的主机创建两个单独的条目是否有特殊的原因?看到他们都使用相同的日志文件和DocumentRoot,你能否将blah.com添加到ServerAlias的列表中?

所以,你最终会与下面的配置如下:

<VirtualHost *:80> 
ServerAdmin [email protected] 
ServerName v1.blah.com 
ServerAlias v1.blah.com blah.com 
DocumentRoot /home/blah/v1.blah.com 
<Directory /home/blah/v1.blah.com/> 
      AllowOverride All 
      Order allow,deny 
      allow from all 
</Directory> 
AccessFileName .htaccess 
ErrorLog /home/blah/blah_logs/v1.blah.com.in-error_log 
CustomLog /home/blah/blah_logs/v1.blah.com.in-access_log common 
</VirtualHost> 
+0

完美@ patyx7是得到了它要在这种情况下。我仍然想知道为什么主机名影响如何/为什么.htaccess被调用,如果任何人都可以阐明。 –