已忽略.htaccess中的apache重定向
我有一个简短的.htaccess文件已忽略.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未更改) 我
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/
您的设置不起作用。我也试过,它对我很有效。