2012-01-31 332 views
2

我讀了關於Zend_Controller_Router_Route_Hostname,但我不知道如何。 我嘗試使用it,zend documentation。但是,當我嘗試打開someoneusername.localhost/我的瀏覽器沒有發現任何東西(糟糕!谷歌瀏覽器無法找到...)。如何配置.htaccess,虛擬主機,主機使用Zend_Controller_Router_Route_Hostname?

我驗證了我的.htaccess

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 

和虛擬主機配置

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName localhost 
    DocumentRoot "/var/www/zendtest/public" 
    <Directory "/var/www/zendtest/public"> 
     Options Indexes FollowSymLinks MultiViews 
     DirectoryIndex index.php 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
    ErrorLog ${APACHE_LOG_DIR}/error-localhost.log 
    CustomLog ${APACHE_LOG_DIR}/access-localhost.log combined 
</VirtualHost> 

hosts文件

127.0.0.1 localhost 

請幫助我的人。

回答

2

假設其他一切都已經正確配置,你想改變你的虛擬主機指令:

ServerName localhost 

ServerName localhost 
ServerAlias *.localhost 

,然後重新啓動Apache。 恐怕你的主機文件運氣不佳(wildcards unsupported) 查看替代方案的鏈接。

+0

someoneusername.localhost要動態,johan.localhost,shad.localhost。 – 2012-02-01 00:17:17

+0

@iJD更新回答 – Shad 2012-02-01 00:22:34

+0

我安裝了dnsmasq和workS!完美的事情。我使用了Jeremy Kendall在[DNS WILDCARD]中提出的配置(http://daniel.hahler.de/easy-dns-wildcard-setup-for-local-domains-using-dnsmasq/) – 2012-02-01 18:08:02