【问题标题】:How configure .htaccess, vhost, hosts to use Zend_Controller_Router_Route_Hostname?如何配置 .htaccess、vhost、hosts 以使用 Zend_Controller_Router_Route_Hostname?
【发布时间】:2012-01-31 23:56:41
【问题描述】:

我读到了 Zend_Controller_Router_Route_Hostname,但我不知道怎么做。 我尝试使用itzend documentation。但是当我尝试打开someoneusername.localhost/时,我的浏览器什么也没找到。(哎呀!谷歌浏览器找不到...)。

我验证了我的 .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 webmaster@localhost
     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>

主机文件

127.0.0.1    localhost

请有人帮助我。

【问题讨论】:

    标签: php zend-framework .htaccess apache2 router


    【解决方案1】:

    假设其他所有内容都已正确配置,您需要更改您的 VirtualHost 指令:

    ServerName localhost
    

    ServerName localhost
    ServerAlias *.localhost
    

    然后重启apache。 恐怕您对主机文件不走运(wildcards unsupported) 查看替代方案的链接。

    【讨论】:

    • someoneusername.localhost 想要动态,johan.localhost,shad.localhost。
    • 我安装了 dnsmasq 和 workS!美妙的。我使用了 Jeremy Kendall 在DNS WILDCARD 中提出的配置
    猜你喜欢
    • 2020-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    • 2013-10-21
    • 2015-02-01
    • 2013-02-12
    相关资源
    最近更新 更多