开发者

Rewrite Periods/Dots/(.) in mod_rewrite to plus (+)

How do I change a period/dot (.) into a plus (+) of a match using mod_rewrite? My match is #2.

This is my rule so far:

RewriteRule ^(.*)/(.*)-[0-9]*\.shtml$ http://kentwired.com/search/most-popular/?searchphrase=exact&searchword=$2 [L,R=301]

With my rules currently,

http://media.www.kentnewsnet.com/media/storage/paper867/news/2009/12/11/New开发者_如何学Cs/Tough.Economy.Leaves.Bodies.Unburried-3850836.shtml

becomes

http://kentwired.com/search/most-popular/?searchphrase=exact&searchword=Tough.Economy.Leaves.Bodies.Unburried

but I need

http://kentwired.com/search/most-popular/?searchphrase=exact&searchword=Tough+Economy+Leaves+Bodies+Unburried


Try this:

RewriteRule ^([^.]*)\.(.*\.shtml)$ /$1+$2 [N]
RewriteRule ^.+/([^/]+)-[0-9]*\.shtml$ http://kentwired.com/search/most-popular/?searchphrase=exact&searchword=$1 [L,R=301]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜