如何配置.htaccess,虚拟主机,主机使用Zend_Controller_Router_Route_Hostname?
问题描述:
我读了关于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
请帮助我的人。
答
假设其他一切都已经正确配置,你想改变你的虚拟主机指令:
ServerName localhost
到
ServerName localhost
ServerAlias *.localhost
,然后重新启动Apache。 恐怕你的主机文件运气不佳(wildcards unsupported) 查看替代方案的链接。
someoneusername.localhost要动态,johan.localhost,shad.localhost。 – 2012-02-01 00:17:17
@iJD更新回答 – Shad 2012-02-01 00:22:34
我安装了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