Zend framework 我如何解决zend framwork中的403禁止错误?

Zend framework 我如何解决zend framwork中的403禁止错误?,zend-framework,http-status-code-403,http-error,Zend Framework,Http Status Code 403,Http Error,我已经用zend framwork开发了我的网站 当我访问我的网站我的网站我得到403禁止错误在我的主页上 我没有在任何其他网页上得到这个错误,只是在主页上得到了错误 我的根目录中没有index.php文件,但live server上的公用文件夹中有index.php文件 我已将write.htacess文件指向根目录上的公用文件夹 请告诉我如何解决这个错误,因为我做过研发,有一些解决方案,有人说是因为根目录上没有index.php 但当我把索引文件,然后我的网站不工作 请帮我解决这个问题 下面

我已经用zend framwork开发了我的网站

当我访问我的网站我的网站我得到403禁止错误在我的主页上

我没有在任何其他网页上得到这个错误,只是在主页上得到了错误

我的根目录中没有index.php文件,但live server上的公用文件夹中有index.php文件

我已将write.htacess文件指向根目录上的公用文件夹

请告诉我如何解决这个错误,因为我做过研发,有一些解决方案,有人说是因为根目录上没有index.php

但当我把索引文件,然后我的网站不工作

请帮我解决这个问题

下面是我在根控制器上的.htacess代码

# BEGIN SSL
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public/$1

## EXPIRES CACHING ##
<IfModule mod_expires.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* ? [F,L]
ExpiresActive On 
ExpiresByType image/jpg "access 1 month" 
ExpiresByType image/jpeg "access 1 month" 
ExpiresByType image/gif "access 1 year" 
ExpiresByType image/png "access 1 year" 
ExpiresByType text/css "access 1 month" 
ExpiresByType text/html "access 1 month" 
ExpiresByType application/pdf "access 1 month" 
ExpiresByType text/x-javascript "access 1 month" 
ExpiresByType application/x-shockwave-flash "access 1 month" 
ExpiresByType image/x-icon "access 1 year" 
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
#开始SSL
重新启动发动机
重写cond%{REQUEST_URI}^/公开的/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/public/$1
##过期缓存##
重新启动发动机
RewriteCond%{HTTP_USER_AGENT}libwww perl.*
重写规则。*?[F,L]
过期于
ExpiresByType图像/jpg“访问1个月”
过期按类型图像/jpeg“访问1个月”
ExpiresByType image/gif“访问1年”
过期按类型图像/png“访问1年”
ExpiresByType文本/css“访问1个月”
ExpiresByType text/html“访问1个月”
过期按类型应用程序/pdf“访问1个月”
ExpiresByType文本/x-javascript“访问1个月”
过期按类型应用程序/x-shockwave-flash“访问1个月”
过期按类型图像/x图标“访问1年”
ExpiresDefault“访问1个月”
##过期缓存##

您的重写规则应该以index.php为目标

比如说

RewriteRule^(.*)$/public/index.php

或者您的虚拟主机应该具有

<Directory />
    AllowOverride none
    Require all granted
</Directory>

我尝试了以下解决方案及其工作

在根文件夹中创建index.php:

<?php 
define('RUNNING_FROM_ROOT', true);
include 'public/index.php';
SetEnv APPLICATION_ENV production

RewriteEngine On
RewriteRule .* index.php
可能在测试时将应用程序_ENV设置为开发:)


请注意,在引用静态文件时,baseUrl()视图帮助器现在指向的是您的根文件夹,而不是您的公用文件夹。

您好,很抱歉,当我这样做时,我的网站会给我带来很多错误,例如css,图像未加载#在RewriteCond%{REQUEST_URI}上启动SSL RewriteEngine^/public/RewriteCond%{REQUEST_FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写了规则^(.*)$/public/index.phpOf课程,因为在此之前您应该排除这样的资源:
RewriteCond%{REQUEST\u URI}!\。(?:css | js | jpe?g | gif | png)$[NC]RewriteRule^(.*)$/public/index.php[L]
SetEnv APPLICATION_ENV production

RewriteEngine On
RewriteRule .* index.php