【发布时间】:2011-02-10 22:22:27
【问题描述】:
我有一个网上商店,里面有一个搜索栏。当我搜索时,我被转发到一个如下所示的链接:
webshopdomain.com/index.php?route=product/search&keyword=我的搜索词组
(嗯,更像是这样:webshopdomain.com/index.php?route=product/search&keyword=my%20search%20phrase)
我需要在 htaccess 中添加什么来使这个 url : webshopdomain.com/search/my%20search%20phrase 显示上述 url 的内容?
我一直在玩这个工具 (http://www.webconfs.com/url-rewriting-tool.php),但不明白如何抓取搜索词组并将其放入静态 url。
我也一直在谷歌上搜索,但由于缺乏正确的措辞,我没有找到答案。
谢谢:-)
编辑:
我可以用这个吗? (刚想好,要测试...)
Options +FollowSymLinks
RewriteEngine on
RewriteRule search/(.*) index.php?route=product/search&keyword=$1
RewriteRule search/(.*)/ index.php?route=product/search&keyword=$1
【问题讨论】:
标签: .htaccess url mod-rewrite redirect rewrite