我的 mod_rewrite 不起作用,出了什么问题?

发布于 2024-08-25 11:16:39 字数 640 浏览 3 评论 0原文

我有以下重写规则,但是当我尝试使用它时什么也没有发生。我的文件位于 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

有谁知道为什么这根本不起作用?

谢谢,

蒂姆

I have the following rewrite rule, but nothing is hapenning at all when I try to use it. I have the file in the directory server.blahblahblah.com/todo and the following is my .htaccess file:

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

Does anyone know why this won't work at all?

Thanks,

Tim

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情场扛把子 2024-09-01 11:16:39

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

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

If nothing happens at all, it might be that you didn't enable .htaccess files for your site. To do that, change your site configuration (/etc/apache2/sites-enabled/<yoursite>) to include AllowOverride All instead of AllowOverride None (the default). But mind the performance disadvantage - you could also put the rules directly in the site configuration.

In case that doesn't solve it, look at the Apache logs in /var/log/apache2/*.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文