htaccess 重写规则重复 - 请帮帮我 / RewriteRule ^(.*)\+apple\+fruit/$ ?q=$1 [L]

发布于 2024-08-27 16:48:59 字数 410 浏览 4 评论 0原文

我的 .htaccess 中有这段代码:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\+apple\+fruit/$ ?q=$1 [L]

这会将搜索查询转入 /keyword+apple+fruit/

,没关系。唯一的问题是,如果我输入 /keyword+apple+fruit +any+text+haha+< /strong> 苹果+水果/ htacces 正在显示内容 - 但我不想要这样。

是否有任何命令可以说 - 好吧,苹果+水果仅在网址中一次,第二次发送 404 或不显示任何内容..

谢谢!!

I have this code in my .htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\+apple\+fruit/$ ?q=$1 [L]

this turns the searchquery in /keyword+apple+fruit/

thats ok.. the only problem is, if I type in /keyword+apple+fruit +any+text+haha+ apple+fruit/
the htacces is showing content - but I don't want that.

is there any command to say - ok apple + fruit only one time in the url and the second time send a 404 or show nothing..

thank you!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

堇年纸鸢 2024-09-03 16:48:59

您可以使用 RewriteCond排除这种情况:

RewriteCond $1 !apple\+fruit
RewriteRule ^(.*)\+apple\+fruit/$ ?q=$1 [L]

You can use a RewriteCond to exclude such a case:

RewriteCond $1 !apple\+fruit
RewriteRule ^(.*)\+apple\+fruit/$ ?q=$1 [L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文