简体   繁体   English

在htaccess重写条件下捕获URL

[英]Catching url in htaccess rewrite condition

I got this url 我得到了这个网址

/search/renttype-all.place-all.type-all.bedrooms-all.0.0/

I want to get the text after the second "/" and the third "/". 我想在第二个“ /”和第三个“ /”之后获取文本。 The URL can end at the third "/" or go on with more text and "/". URL可以以第三个“ /”结尾,也可以包含更多文本和“ /”。 I have been trying with a lot of rules but never got any to work. 我一直在尝试许多规则,但没有任何工作。 My last try was 我最后的尝试是

RewriteRule ^search/(.+)/$ index.php?Search=0&Arg=$1 [NC]
RewriteRule ^search/(.+)/(.+)$ index.php?Search=0&Arg=$1 [NC]

Anyone that can show me how to make a rule that works? 有人可以告诉我如何制定有效的规则吗? :) Thanks for reading my question! :)感谢您阅读我的问题!

这解决了我的问题

RewriteRule ^search/([^/]+)/ index.php?Search=0&Arg=$1 [NC]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM