我在 Amazon EC2 的 ubuntu 12.04 中使用 apache 2.2。我启用了 mod_rewrite 使用
sudo a2enmod rewrite
并且能够看到
apache2ctl -M
现在我编写了 .htaccess 代码如下但不工作
# Redirect everything in this directory to "good.html"
Options +FollowSymlinks
RewriteEngine on
RewriteRule .* good.html
这是我的 /etc/apache2/sites-available/default http://pastebin.com/urNfmqan的内容
当我添加
LoadModule rewrite_module modules/mod_rewrite.so
到 httpd.conf 时,我得到了这个
waiting [Thu Apr 11 18:44:12 2013] [warn] module rewrite_module is already loaded, skipping
并且 htaccess 即使在那时也无法正常工作(我假设在 apache2.2 我们不编辑 httpd.conf 以启用 rewrite_mod 但根据 anubhava 评论我修改了问题)