.htaccess 在 ubuntu 14.04 上不起作用

.htaccess 在 ubuntu 14.04 上不起作用

以下是 000-default.conf 中的相关代码:

<Directory /var/www/html/>
    AllowOverride All
</Directory>

但是当我放入 .htaccess 时,即使其中没​​有任何内容,除索引之外的每个站点都会返回 403 错误。而且 phpinfo() 中没有 mod_rewrite。我做错了什么?

答案1

请查看以下内容,因为一些语法从 2.2 到 2.4 已经发生了变化:

从 2.2 升级到 2.4 - Apache HTTP 服务器版本 2.5

以下举几个例子:

In this example, all requests are denied.

2.2 configuration:

Order deny,allow
Deny from all
2.4 configuration:

Require all denied
In this example, all requests are allowed.

2.2 configuration:

Order allow,deny
Allow from all
2.4 configuration:

Require all granted
In the following example, all hosts in the example.org domain are allowed access; all other hosts are denied access.

2.2 configuration:

Order Deny,Allow
Deny from all
Allow from example.org
2.4 configuration:

Require host example.org

相关内容