开发者

Regular expression for Url rewriting php

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 sl开发者_StackOverflow社区ash removed).

But this doesn't work.


Try

RewriteEngine on
RewriteRule .*site_artisans/site_artisans/(.*) site_artisans/site_artisans$1 [L]

I tested it on http://martinmelin.se/rewrite-rule-tester/ and I believe the result is what you want.


Try this:

RewriteEngine on
RewriteRule .*site_artisans/(site_artisans/.*) site_artisans/$1 [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜