【问题标题】:apache rewrite is doing redirectapache rewrite 正在做重定向
【发布时间】:2017-07-11 03:12:43
【问题描述】:

在 apache2 中,当我按照重写规则编写时,重写正在执行重定向

RewriteRule  ^id/(.*)$ http://pickyourjersey.com/index.php?id=$1 [NC,L]

如果我要移除 NC,那么它会显示错误

错误请求

您的浏览器发送了一个此服务器无法理解的请求。 Apache/2.4.7 (Ubuntu) 服务器位于 pickyourjersey.com 端口 80

如果我使用相对路径,它可以正常工作

【问题讨论】:

  • 重写到一个完整的 URL 总是会导致重定向 - 你还能期待什么?
  • 除此之外还不清楚您的实际问题是什么......

标签: redirect mod-rewrite apache2


【解决方案1】:

替换为 重写引擎开启 RewriteRule "^id/(.*)" "http://pickyourjersey.com/index.php?id=$1" [NC,L]

【讨论】:

  • 我已经这样做了,但它给出了内部服务器错误
  • 错误日志是这样说的
  • /var/www/pickyourjersey.com/public-html/.htaccess:RewriteEngine 必须是 On 或 Off,referer:pickyourjersey.com/id/2
猜你喜欢
  • 2011-05-06
  • 1970-01-01
  • 2018-03-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-14
  • 2021-01-24
  • 1970-01-01
相关资源
最近更新 更多