Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php CentOS Apache.htaccess:此处不允许选项(500-内部服务器错误)_Php_Apache_.htaccess_Mod Rewrite_Centos7 - Fatal编程技术网

Php CentOS Apache.htaccess:此处不允许选项(500-内部服务器错误)

Php CentOS Apache.htaccess:此处不允许选项(500-内部服务器错误),php,apache,.htaccess,mod-rewrite,centos7,Php,Apache,.htaccess,Mod Rewrite,Centos7,我正在CentOS 7中安装Apache,这是我的httpd.conf- 这是我的文档根目录:/home/host/public\u html 为了测试.htaccess文件是否有效&如果启用了mod\u rewrite,我已将示例.htaccess从一个laravel项目上载到/home/host/public\u html/.htaccess,其中包含以下内容: <IfModule mod_rewrite.c> <IfModule mod_negotiation.c

我正在CentOS 7中安装Apache,这是我的httpd.conf-

这是我的文档根目录:/home/host/public\u html

为了测试
.htaccess
文件是否有效&如果启用了
mod\u rewrite
,我已将示例
.htaccess
从一个laravel项目上载到
/home/host/public\u html/.htaccess
,其中包含以下内容:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
当我访问
http:///index.php
,我得到以下错误:

500内部服务器错误

我在
/var/log/httpd/apache\u error\u log
文件中找到了以下内容:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride Options
    Order allow,deny
    allow from all
</Directory>
[Thu Dec 31 15:50:43.696465 2015][core:alert][pid 23807][client xxx.xxx.xxx.xxx:56536]/home/host/public_html/.htaccess:此处不允许选项

如果我从
.htaccess
文件中删除以下行:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride Options
    Order allow,deny
    allow from all
</Directory>

选项-多视图
脚本似乎已加载,没有错误


有什么问题吗?

.htaccess:Options not allowed here错误表示不允许htaccess文件使用Options指令更改设置

要修复此错误,请编辑apache配置文件
/etc/httpd/conf/httpd.conf
:-


选项索引跟随符号链接多视图
允许超车选项
命令允许,拒绝
通融
将“选项”添加到AllowOverride列表将允许在htaccess文件中使用选项指令

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride Options
    Order allow,deny
    allow from all
</Directory>