简体   繁体   English

.htaccess“此处不允许选项”

[英].htaccess "Options not allowed here"

I have this in my .htaccess:我的 .htaccess 中有这个:

Options +FollowSymLinks选项 +FollowSymLinks

And I get the following error in the apache error_log:我在 apache error_log 中收到以下错误:

.htaccess: Options not allowed here

Here's the part from my httpd.conf file:这是我的 httpd.conf 文件中的一部分:

#htdocs symlinks here
<Directory /Users/you/code/my/folder>
    Options All
    AllowOverride All
</Directory>

<Directory />
    Options All
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<Directory "/Applications/XAMPP/xamppfiles/htdocs">
    Options All 
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

So I'm setting Options All and AllowOverride All everywhere, but STILL I'm not allowed to set the option.所以我在任何地方都设置了 Options All 和 AllowOverride All ,但仍然不允许我设置该选项。 Can anyone make sense of this?任何人都可以理解这一点吗?

Thanks, MrB谢谢,B先生

Note that this is a XAMPP-specific issue.请注意,这是特定于 XAMPP 的问题。 XAMPP loads some additional configuration files located in XAMPP/etc/extra/ that override httpd.conf. XAMPP 加载位于XAMPP/etc/extra/中的一些附加配置文件,这些文件覆盖 httpd.conf。 For me the offending file is http-userdir.conf which applies rules for ~user requests and contains the line AllowOverride FileInfo AuthConfig Limit Indexes and changing that line to AllowOverride All did indeed solve my issue.对我来说,有问题的文件是http-userdir.conf ,它为 ~user 请求应用规则并包含AllowOverride FileInfo AuthConfig Limit Indexes行,并将该行更改为AllowOverride All确实解决了我的问题。

This only applies to files served from your /Sites/ directory on OS X. I don't know if the Windows version uses UserDir at all or even has a similar rule.这仅适用于从 OS X 上的 /Sites/ 目录提供的文件。我不知道 Windows 版本是否使用 UserDir 甚至有类似的规则。

in my case I end up with change the line AllowOverride AuthConfig FileInfo to AllowOverride All in file httpd-vhosts.conf where this file is located in apache\conf\extra folder在我的情况下,我最终将文件 httpd-vhosts.conf 中的 AllowOverride AuthConfig AllowOverride AuthConfig FileInfo行更改为 AllowOverride AllowOverride All ,该文件位于 apache\conf\extra 文件夹中

You have to allow overrides for "Options" within directory context.您必须允许在目录上下文中覆盖“选项”。 there's no need to:没有必要:

vhost/directory config:
    AllowOverride All

But only to permit overrides for 'Options':但仅允许覆盖“选项”:

    AllowOverride {Existing options to override} +Options

I just installed the most recent version of XAMPP and thought to share how I solved the same problem.我刚刚安装了最新版本的 XAMPP 并想分享我如何解决同样的问题。

This is a XAMPP specific setting (with every new XAMPP install).这是 XAMPP 特定设置(每个新的 XAMPP 安装)。 The most recent up to date XAMPP as of today - XAMPP 1.8.3 have a setting in /xampp/apache/conf/extra/httpd-xampp.conf that's causing your "Server Error" message.截至今天,最新的 XAMPP - XAMPP 1.8.3在 /xampp/apache/conf/extra/httpd-xampp.conf 中有一个设置会导致您的“服务器错误”消息。

And then you get the following error in your error log:然后您在错误日志中收到以下错误:

.htaccess: Options not allowed here

Open /xampp/apache/conf/extra/httpd-xampp.conf and find:打开 /xampp/apache/conf/extra/httpd-xampp.conf 并找到:

<Directory "/xampp/htdocs/xampp">
    <IfModule php5_module>
        <Files "status.php">
            php_admin_flag safe_mode off
        </Files>
    </IfModule>
    AllowOverride AuthConfig
</Directory>

and change和改变

AllowOverride AuthConfig

with

AllowOverride All

No authentication or authorization will be required after the change UNLESS you specify it in your httpd.conf, extra confs or in .htaccess.更改后不需要身份验证或授权,除非您在 httpd.conf、extra confs 或 .htaccess 中指定它。

You may also want to read the Apache documentation for the option AllowOverride http://httpd.apache.org/docs/current/en/mod/core.html#allowoverride and choose more optimal and secure setting that will allow you to use your .htaccess without causing a server error.您可能还需要阅读 Apache 文档以了解 AllowOverride 选项http://httpd.apache.org/docs/docs/current/en/mod/core.html允许您使用最佳设置和安全设置。 .htaccess 不会导致服务器错误。

Also keep in mind that you can find a better place to rewrite the rule above depending on the results that you'd like to achieve.另请记住,您可以根据您想要达到的结果找到更好的地方来重写上述规则。 In my case this is a satisfactory change.就我而言,这是一个令人满意的变化。

I guess there is a global AllowOverride setting in your apache config which disallows this.我猜您的 apache 配置中有一个全局AllowOverride设置不允许这样做。 Can you grep for AllowOverride in your httpd.conf?您可以在 httpd.conf 中为 AllowOverride 提供 grep 吗?

instead of changing the global AllowOverride settings in your main httpd.conf file, if you have a httpd-vhosts.conf file you would want to put directory specific AllowOverride All directives in each host entry that you need it in, so you can keep a restrictive set on the rest of the server realm.而不是更改主 httpd.conf 文件中的全局 AllowOverride 设置,如果您有一个 httpd-vhosts.conf 文件,您希望将特定于目录的 AllowOverride All 指令放在您需要它的每个主机条目中,这样您就可以保留一个服务器 realm 的 rest 上的限制性设置。

Change Options +FollowSymLinks into Options +SymLinksIfOwnerMatch in all instances of .htaccess file, the followsymlinks has been disabled on many server due to security risk.在 .htaccess 文件的所有实例中将选项 + Options +FollowSymLinks更改为Options +SymLinksIfOwnerMatch ,由于安全风险,许多服务器上已禁用以下符号链接。

On Debian 9 i edited the file /etc/apache2/mods-available/userdir.conf在 Debian 9 我编辑了文件 /etc/apache2/mods-available/userdir.conf

Disabled this line AllowOverride FileInfo AuthConfig Limit Indexes禁用此行AllowOverride FileInfo AuthConfig 限制索引

Added this line Allowoverride All添加了这一行Allowoverride All

And it worked fine.它工作得很好。

Many thanks to all who contributed非常感谢所有贡献的人

Does the server your domain is hosted on fulfills all requirements needed for Elgg?托管您的域的服务器是否满足 Elgg 所需的所有要求? Especially, is mod_rewrite available?特别是 mod_rewrite 可用吗?

Re-check all steps you had done.重新检查您已完成的所有步骤。

If mod_rewrite is working... Do you have access to the configuration (http.conf) of Apache on your server?如果 mod_rewrite 正在工作...您是否有权访问服务器上 Apache 的配置(http.conf)? If yes, add the following lines (adjust the path):如果是,添加以下行(调整路径):

AllowOverride All允许覆盖所有

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM