php url重写正则表达式
我正在使用 Wamp 进行 URL 重写,但找不到满足我需求的正确正则表达式。
我想转换 http://localhost/site_artisans/site_artisans/peintre-annecy.php 在 http://localhost/site_artisans/site_artisanspeintre-annecy.php (删除 site_artisans/site_artisans 和后面的内容之间的斜线)。
我想到:(
RewriteEngine on
RewriteRule .*site_artisans/site_artisans/.* site_artisans/site_artisans [L]
前后未知数量的字符并删除斜线)。
但这行不通。
I'm using URL rewriting with Wamp but I don't find the correct regex for my needs.
I'd like to transform http://localhost/site_artisans/site_artisans/peintre-annecy.php in http://localhost/site_artisans/site_artisanspeintre-annecy.php (remove the slash between site_artisans/site_artisans and whatever is after).
I thought of :
RewriteEngine on
RewriteRule .*site_artisans/site_artisans/.* site_artisans/site_artisans [L]
(Unknown number of characters before and after and slash removed).
But this doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
在 http://martinmelin.se/rewrite-rule-tester/ 上测试它并我相信结果就是你想要的。
Try
I tested it on http://martinmelin.se/rewrite-rule-tester/ and I believe the result is what you want.
试试这个:
Try this: