Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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
已忽略.htaccess中的apache重定向_Apache_.htaccess_Redirect - Fatal编程技术网

已忽略.htaccess中的apache重定向

已忽略.htaccess中的apache重定向,apache,.htaccess,redirect,Apache,.htaccess,Redirect,我有一个简短的.htaccess文件 Redirect permanent /home http://www.example.com/ RewriteEngine On RewriteRule ^(home|about|gallery|video|crafts|contact|press)$ /$1.html [L] DirectoryIndex home.html 它的所有功能都可以在本地MAMP安装上使用。 第一行在我的实际apache服务器(Debian)上不起作用(URL未更改) 我

我有一个简短的.htaccess文件

Redirect permanent /home http://www.example.com/

RewriteEngine On
RewriteRule ^(home|about|gallery|video|crafts|contact|press)$ /$1.html [L]
DirectoryIndex home.html
它的所有功能都可以在本地MAMP安装上使用。
第一行在我的实际apache服务器(Debian)上不起作用(URL未更改)

我已经尝试过在重写规则的上方和下方使用重定向,并尝试了第一个URL,前面有斜杠(/home和home)和前面没有斜杠(/home和home)

我在/etc/apache2/sites中的conf文件中有一个“AllowOverride All”,正如我所说,该文件的其余部分将得到尊重

已安装mod_别名(在/etc/apache2/mods enabled/中)

我在错误日志中没有看到任何内容


有什么想法吗?

在.htacces文件中尝试以下代码:

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /

RewriteRule ^home/?$ http://www.example.com/ [L,NC,R=301]
RewriteRule ^(about|gallery|video|crafts|contact|press)/?$ $1.html [L,NC]

我很确定这会起作用,但是你有什么理论来解释为什么更简单的'Redirect'指令不起作用吗?我不确定为什么
Redirect permanent/homehttp://www.example.com/
您的设置不起作用。我也试过,它对我很有效。