WordPress htaccess 问题

发布于 2024-08-26 11:27:23 字数 699 浏览 1 评论 0原文

我的 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

轻拂→两袖风尘 2024-09-02 11:27:23

将所需表达式的部分放在括号内。我从你的字符集中删除了 / 字符,这样它就不会抓取 URL 的 buydualit/ 部分,并将其放在抓取部分之外。最后,抓取的部分按顺序编号,因此您必须切换 $1 和 $2

RewriteRule ^buydualit/([A-Za-z-0-9,\"'-]+)-([0-9]+)\/$ buydualit/index.php?pagenum=$2&searchitem=$1

另外,这可能不属于这里,因为它更多的是系统管理问题而不是软件开发问题。

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

RewriteRule ^buydualit/([A-Za-z-0-9,\"'-]+)-([0-9]+)\/$ buydualit/index.php?pagenum=$2&searchitem=$1

Also, this probably doesn't belong here, as it's more of a system administration question than a software development question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文