【问题标题】:why is the mod Rewrite Rule not working?为什么 mod 重写规则不起作用?
【发布时间】:2015-01-06 13:57:31
【问题描述】:

我已尝试使用此代码:

Rewrite Rule    ^products/([0-9]+)/?$    add-category/?cid=$1    [NC,L]   

但它不起作用。

我的网址是http://webmicrodemo.com/haraz/ad-category/index.php?cid=9

我想把它改成http://webmicrodemo.com/haraz/cat/9

【问题讨论】:

  • 这可能有大约 100 万个原因,其中之一是根本没有安装 mod_rewrite,因此 .htaccess 文件被忽略。请通过以下方式改进您的问题:1)检查所有内容是否安装正确,以及 2)您尝试了什么以及结果在哪里(服务器错误?哪些?重定向循环?)

标签: php mod-rewrite


【解决方案1】:

一定要写成正确的格式,下面给出正确的方法

#This is for listing active product page
RewriteRule ^(add-category)/([a-zA-Z-_0-9]+)-([0-9]+)/$ index.php?cid=$3
RewriteRule ^(add-category)/([a-zA-Z-_0-9]+)-([0-9]+)$ index.php?cid=$3

【讨论】:

  • 我使用上述规则但没有解决。我已经检查了 mode_rewrite 是否已安装。
猜你喜欢
  • 1970-01-01
  • 2017-08-31
  • 2015-07-26
  • 1970-01-01
  • 1970-01-01
  • 2017-01-15
  • 1970-01-01
  • 2010-11-13
相关资源
最近更新 更多