【问题标题】:My mod_rewrite won't work, what's wrong?我的 mod_rewrite 不起作用,怎么了?
【发布时间】:2010-08-18 14:27:35
【问题描述】:

我有以下重写规则,但是当我尝试使用它时根本没有发生任何事情。我在目录 server.blahblahblah.com/todo 中有文件,以下是我的 .htaccess 文件:

Options +FollowSymLinks
Options +Indexes

RewriteEngine On
RewriteBase /

RewriteRule ^tasks/view/([0-9]+)?/$ controller.php?task=view&id=$1
RewriteRule ^tasks/view/([0-9]+)\.xml$ controller.php?task=viewxml&id=$1
RewriteRule ^tasks/new?/$ controller.php?task=new
RewriteRule ^tasks/delete/([0-9]+)?/$ controller.php?task=delete&id=$1
RewriteRule ^tasks/completed/([0-9]+)?/$ controller.php?task=complete&id=$1
RewriteRule ^tasks?/$ controller.php?task=home

有人知道为什么这根本行不通吗?

谢谢,

提姆

【问题讨论】:

    标签: mod-rewrite apache2


    【解决方案1】:

    如果没有任何反应,可能是您没有为您的站点启用 .htaccess 文件。为此,请将您的站点配置 (/etc/apache2/sites-enabled/<yoursite>) 更改为包含 AllowOverride All 而不是 AllowOverride None(默认值)。但请注意性能劣势 - 您也可以将规则直接放在站点配置中。

    如果不能解决问题,请查看 /var/log/apache2/* 中的 Apache 日志。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-18
      • 1970-01-01
      • 2012-10-10
      • 2014-08-31
      • 2012-12-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多