Php .htaccess与虚拟主机zend framework 1 ubuntu

Php .htaccess与虚拟主机zend framework 1 ubuntu,php,apache,.htaccess,zend-framework,virtual-hosts,Php,Apache,.htaccess,Zend Framework,Virtual Hosts,我在文件夹:var/www/vhosts/dev.blla.com/httpdocs/src中设置了一个具有虚拟主机的Ubuntu服务器,它是使用zend framework 1构建的web应用程序。 问题是我有一个.htaccess文件,如下所示: <VirtualHost dev.blla.com:80> ServerName dev.blla.com DocumentRoot /var/www/vhosts/dev.blla.com/httpdocs

我在文件夹
:var/www/vhosts/dev.blla.com/httpdocs/src
中设置了一个具有虚拟主机的Ubuntu服务器,它是使用zend framework 1构建的web应用程序。 问题是我有一个.htaccess文件,如下所示:

<VirtualHost dev.blla.com:80>
    ServerName   dev.blla.com
    DocumentRoot /var/www/vhosts/dev.blla.com/httpdocs

    RewriteEngine off

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

您的vhost文件应该如下所示。不要使用
location
指令,尤其是对root
/
指令。您应该使用
目录

<VirtualHost dev.blla.com:80>
    ServerName   dev.blla.com
    DocumentRoot /var/www/vhosts/dev.blla.com/httpdocs

    <Directory "/var/www/vhosts/dev.blla.com/httpdocs">
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} -s [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    </Directory>
</VirtualHost>

编辑:显然,您的.htaccess文件中有这个。那是行不通的。这应该是我上面提到的vhost文件。htaccess中唯一允许的东西就是这个。VirtualHost和Directory不能在.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]
这也可能对你有所帮助


检查以确保您已启用Apache的重写模块。该模块已由a2enmod Rewrite检查启用,该Rewrite返回模块Rewrite ALEABLED ENABLE删除Rewrite ENGINE Off(重写引擎关闭)的行,以确保已启用。否则,尝试更简单的重写。类似于
RewriteCond%{REQUEST\u FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写规则^(.*)$index.php[NC,L]
我将重写引擎从同一结果中移除。我应该把以下内容放在哪里:RewriteCond%{REQUEST_FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写规则^(.*)$index.php[NC,L]是的,我们需要更多关于设置的详细信息。如果您遇到Nginx和apache错误,您可能正在使用代理服务或专门设置。我做了上述所有操作,但仍然遇到500个内部服务器错误,我还检查了一个错误日志。我得到了这个错误/var/www/vhosts/dev.blla.com/httpdocs/.htaccess:等等,这是在您的.htaccess文件中吗?这应该是您的虚拟主机文件。是的,它在.htaccess文件中,我应该把它放在哪里?vhost文件在哪里?我更改了它,并重新启动了apache服务。现在登录页正常工作,但其他页面不正常。我得到:未找到此服务器上未找到请求的文档。
server config, virtual host, directory, .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]