WordPress htaccess 问题
我的 .htaccess 文件有一些问题。在这里我添加我的问题。请帮我。
我的实际网址如下 http://localhost/buydualit/?searchitem=toaster&pagenum= 1 这里使用我的 .htaccess 将我的 URL 重写为 http://localhost/buydualit/toaster-1/
我的URL重写规则如下
RewriteRule ^[A-Za-z-0-9,\"'-\/]+\-([0-9]+)\/$ buydualit/index.php?pagenum=$1&searchitem=$2
:这条规则如何从 http://localhost/buydualit/toaster- 检索 toaster 1/ (searchitem=$2 没有得到)? 请帮我。
I have some problem with my .htaccess file. Here I am adding my problem. Please help me.
My actual URL is as follows http://localhost/buydualit/?searchitem=toaster&pagenum=1 here by using my .htaccess am rewrited my URL as
http://localhost/buydualit/toaster-1/
My URL rewriting rule is like follows:
RewriteRule ^[A-Za-z-0-9,\"'-\/]+\-([0-9]+)\/$ buydualit/index.php?pagenum=$1&searchitem=$2
In this rule how can I retrieve toaster from http://localhost/buydualit/toaster-1/
(searchitem=$2 which is not getting)?
Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将所需表达式的部分放在括号内。我从你的字符集中删除了 / 字符,这样它就不会抓取 URL 的 buydualit/ 部分,并将其放在抓取部分之外。最后,抓取的部分按顺序编号,因此您必须切换 $1 和 $2
另外,这可能不属于这里,因为它更多的是系统管理问题而不是软件开发问题。
Put parentheses around the parts of the expression you want. I removed the / char from your set of characters so it'd not grab the buydualit/ part of the url, and put it outside the grabbing section. Finally, the grabbed parts are numbered sequentially, so you have to switch $1 and $2
Also, this probably doesn't belong here, as it's more of a system administration question than a software development question.