【问题标题】:.htaccess file not working.htaccess 文件不工作
【发布时间】:2011-02-13 17:18:41
【问题描述】:

我是整个 .htacess 文件的新手 :)

我只是在里面设置了这个: 重写引擎开启 RewriteRule ^/outdoors/trees/([0-9]+) /outdoors/trees/tree.php?tree_id=$1

我在这里做了一个测试页面: http://www.comehike.com/outdoors/trees/tree.php?tree_id=20

看起来像这样: http://www.comehike.com/outdoors/trees/numeric_tree_id/tree-name

但我现在看到我的服务器行为发生了变化。关于可能是什么问题的任何想法?

谢谢!

【问题讨论】:

  • 一些服务器禁用此功能,因为它构成威胁。

标签: php apache .htaccess router


【解决方案1】:

我想应该删除前面的斜线。所以试试这个:

RewriteEngine On
RewriteRule ^outdoors/trees/([0-9]+) outdoors/trees/tree.php?tree_id=$1

【讨论】:

  • 试过但没用。是否有一些应该打开的apache设置?还是需要重启apache?
  • 没有,但是 mod_rewrite 真的安装了吗?
  • 没有线索 :) - 我如何检查它是否已安装?如果不是,我该如何安装它? :) 谢谢!
  • 刚刚与我的托管公司核对过,是的,实际上已安装了 mod_rewrite。但是 .htaccess 文件似乎仍然无法正常工作。
  • 您的 .htaccess 文件是否在域的根目录中? Apache会忽略它吗?这个 RewriteRule 有没有作用:RewriteRule .* http://google.com/ [L,R=302] ?
猜你喜欢
  • 1970-01-01
  • 2015-05-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-14
  • 1970-01-01
  • 2011-12-15
  • 2015-02-21
相关资源
最近更新 更多