【问题标题】:AllowOverride None, and .htaccess worksAllowOverride None,并且 .htaccess 有效
【发布时间】:2014-04-05 03:41:40
【问题描述】:

嗯,这还不是问题,但我不明白为什么 Apache 正在读取 .htaccess 文件...我这样做:

grep -R "AllowOverride" /etc

我有:

/etc/apache2/apache2.conf:# for additional configuration directives.  See also the      AllowOverride
/etc/apache2/sites-available/default:       AllowOverride None
/etc/apache2/sites-available/default:       AllowOverride None
/etc/apache2/sites-available/default:   #   AllowOverride None
/etc/apache2/sites-available/default:#        AllowOverride None
/etc/apache2/sites-available/default-ssl:       AllowOverride None
/etc/apache2/sites-available/default-ssl:       AllowOverride None
/etc/apache2/sites-available/default-ssl:       AllowOverride None
/etc/apache2/sites-available/default-ssl:       AllowOverride None
/etc/apache2/conf.d/security:#  AllowOverride None
/etc/apache2/conf.d/localized-error-pages:#        AllowOverride None
/etc/apache2/mods-available/userdir.conf:                AllowOverride FileInfo AuthConfig Limit Indexes
/etc/apache2/mods-available/alias.conf:    AllowOverride None
/etc/apache2/sites-enabled/000-default:     AllowOverride None
/etc/apache2/sites-enabled/000-default:     AllowOverride None
/etc/apache2/sites-enabled/000-default: #   AllowOverride None
/etc/apache2/sites-enabled/000-default:#        AllowOverride None
/etc/apache2/mods-enabled/alias.conf:    AllowOverride None
grep: /etc/blkid.tab: No such file or directory

似乎我没有 AllowOverride all,为什么它工作?

【问题讨论】:

    标签: .htaccess apache2


    【解决方案1】:

    但你有:

    /etc/apache2/mods-available/userdir.conf:  AllowOverride FileInfo AuthConfig Limit Indexes
    

    虽然这与 userdir 配置有关,但 FileInfo 覆盖是 apache 在该上下文中读取 htaccess 文件的最低要求。

    AllowOverride documentation 中,我们有:

    文件信息

    允许使用控制文档类型的指令(DefaultType、ErrorDocument、ForceType、LanguagePriority、SetHandler、SetInputFilter、SetOutputFilter 和 mod_mime Add* 和 Remove* 指令等)、文档元数据(Header、RequestHeader、SetEnvIf、SetEnvIfNoCase 、BrowserMatch、CookieExpires、CookieDomain、CookieStyle、CookieTracking、CookieName)、mod_rewrite 指令(RewriteEngine、RewriteOptions、RewriteBase、RewriteCond、RewriteRule)、mod_alias 指令(Redirect、RedirectTemp、RedirectPermanent、RedirectMatch)和来自 mod_actions 的 Action。

    AllowOverride 是除“None”之外的任何内容时,htaccess 文件将被读取,并且根据覆盖选项,htaccess 文件中的某些语句将被执行。碰巧FileInfo 选项涵盖了 htaccess 文件中的许多常用指令。

    【讨论】:

    • 好的,谢谢。抱歉没有正确搜索。找到它并不难......好吧,在我的情况下,我给予 htaccess 文件,使用除 Options 和 XBitHack 之外的所有指令的权限。对吗?
    猜你喜欢
    • 2014-08-05
    • 2015-09-12
    • 1970-01-01
    • 2015-12-31
    • 1970-01-01
    • 2013-10-25
    • 2017-07-14
    • 2018-04-11
    • 2012-05-13
    相关资源
    最近更新 更多