.htaccess错误“不允许在这里”的所有说明

我正在使用Debian Lenny和Apache 2.我更改了默认的.htaccess文件:

 AllowOverride AuthConfig 

但是not allowed here当在.htaccess文件中放置任何指令时,我总是会收到错误信息。

编辑:

文件默认值:

 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/ <Directory /> Options FollowSymLinks Order allow,deny Allow from all AllowOverride All </Directory> <Directory /var/www/> Options Indexes FollowSymLinks Includes #AllowOverride All #AllowOverride Indexes AuthConfig Limit FileInfo AllowOverride AuthConfig Order allow,deny Allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> 

的.htaccess:

 #Options +FollowSymlinks # Prevent Directoy listing Options -Indexes # Prevent Direct Access to files <FilesMatch "\.(tpl|ini)"> Order deny,allow Deny from all </FilesMatch> # SEO URL Settings RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA] 

PHP信息:

 apache2handler Apache Version = Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny10 with Suhosin-Patch Apache API Version = 20051115 Server Administrator = webmaster@localhost Hostname:Port = hw-linux.homework:80 User/Group = www-data(33)/33 Max Requests = Per Child: 0 - Keep Alive: on - Max Per Connection: 100 Timeouts = Connection: 300 - Keep-Alive: 15 Virtual Server = Yes Server Root = /etc/apache2 Loaded Modules = core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_status 

您需要在您的<Directory>块中至less使用AllowOverride Authconfig FileInfo选项来获取您在此处发布的.htaccess工作 – mod_rewrite将需要FileInfo Options而您的<FilesMatch>块需要Authconfig

另外:你的陈述“不能与AllowOverride All一起工作”是错误的。 您不能指定比AllowOverride All宽松的环境。 如果有疑问,首先确定其余的configuration工作, 然后更具体地缩小它(为了安全起见)。

这个选项只能在Directory元素中使用。 所以你必须指定一个应该被保护的目录。

不允许在这里通常是由试图在.htaccess文件中设置指令,只能在httpd.conf定义。

第一次尝试

 AllowOverride All 

在你的大多数<Directory>标记到您的www文件夹。 现在,您的.htaccess可以全面运行。 如果解决了这个问题,那么你就可以开始关注安全性,逐个减less允许的指令数量。