.htaccess 和 mod_rewrite 出错 [英] Error with .htaccess and mod_rewrite
问题描述
我正在尝试使用以下 .htaccess 值托管基于 php 的应用程序.
I'm trying to host a php based application with the following .htaccess values.
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine On
RewriteBase /easydeposit
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
然而,我一直面临以下两个错误,
However, I keep facing the following two errors,
[access_compat:error] [pid 25330:tid 27] AH01797: client denied by server configuration: /home/abc/opt/apache/htdocs/xyz/system/
[access_compat:error] [pid 25330:tid 27] AH01797: client denied by server configuration: /home/abc/opt/apache/htdocs/xyz/private/
[access_compat:error] [pid 25330:tid 27] AH01797: client denied by server configuration: /home/abc/opt/apache/htdocs/xyz/application/
[authz_core:error] [pid 25330:tid 27] AH01630: client denied by server configuration: /home/abc/opt/apache/htdocs/xyz/.htaccess
我不确定为什么会发生这种情况.任何帮助表示赞赏.
I'm not sure why this is happening. Any help is appreciated.
推荐答案
如果您最近升级到高于 2.2 的 Apache 版本,则 authz_core 错误错误可能来自您的 httpd.conf 或 httpd-vhosts.conf
标签中的文件.mod_authz_core 是在 Apache 2.3 中引入的,它改变了声明访问控制的方式.
If you have recently upgraded to a version of Apache greater than version 2.2, the authz_core error error might be coming from your httpd.conf or httpd-vhosts.conf file in the <Document>
tags. mod_authz_core was introduced in Apache 2.3 and changed the way that access control is declared.
所以,例如,代替2.2的配置
...
So, for example, instead of the 2.2 way of configuring <Directory>
...
<Directory "C:/wamp">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Order 和 Allow 指令已替换为 Require 指令:
Order and Allow directives have been replaced with the Require directive:
<Directory "C:/wamp">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
来源http://www.andrejfarkas.com/2012/06/fun-with-wamp-server-and-apache-2-4-2/http://httpd.apache.org/docs/2.4/upgrading.html
这篇关于.htaccess 和 mod_rewrite 出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!