我正在使用 Debian Lenny 和 Apache 2。我更改了默认.htaccess文件:
AllowOverride AuthConfig
Run Code Online (Sandbox Code Playgroud)
但是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>
Run Code Online (Sandbox Code Playgroud)
.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]
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
您将需要最少的AllowOverride Authconfig FileInfo Options在您的<Directory>块中才能使.htaccess您在此处发布的内容起作用 -mod_rewrite将需要FileInfo Options并且您的<FilesMatch>块需要Authconfig.
另外:您的陈述“不适用于 AllowOverride All”是错误的。您不能指定比 更宽松的环境AllowOverride All。如有疑问,请先确保其余配置正常工作,然后更具体地缩小范围(为了安全起见)。
| 归档时间: |
|
| 查看次数: |
17158 次 |
| 最近记录: |