.htaccess无法在Cent Os上运行6.4

我已经安装了Cent Os 6.4 -Final Version,并为PHP Web开发设置了环境。

我的应用程序使用.htaccess的URL重写&否认直接访问文件。

我的configuration文件httpd – /etc/httpd/conf/httpd.conf如下,

<Directory "/var/www/html"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Order allow,deny Allow from all </Directory> 

当我将AllowOverride None更改为AllowOverride All时 ,它会要求进行身份validation。 所以它不适用于我,并给出了如下错误,

 This server could not verify that you are authorized to access the document requested. 

要么提供了错误的凭据(例如错误的密码),要么您的浏览器不知道如何提供所需的凭据。

我的.htaccess看起来像,

 deny from all 

使用httpd.conf中的AllowOverride None设置,.htaccess文件将被完全忽略。 所以你必须改变这个设置。

当.htaccess文件被允许时,apache会检查DocumentRoot中的每一个目录是否存在一个.htaccess文件,并且会在那里下一个目录和.htaccess文件。

例如./www/.htaccess被设置为“拒绝所有”访问者/scripts/test/hello-world.php将被拒绝,尽pipe./www/scripts/test/.htaccess可能已被设置为“全部允许”。

因此,如果不是您的PHP脚本要求身份validation,您可能需要检查.htaccess文件的更高级别的目录。