0

我在使用正则表达式对以下内容进行排序时遇到问题……</p>

http://www.example.com/directory/listings/nostell-priory-2/
http://www.example.com/directory/listings/somerton-court-2/
http://www.example.com/directory/listings/shervage-court-2/

看起来像下面......</p>

http://www.example.com/directory/listings/nostell-priory/
http://www.example.com/directory/listings/somerton-court/
http://www.example.com/directory/listings/shervage-court/

我只是想-2从 url 中删除位,但前提是 url 包含单词listings

任何人都可以帮忙吗?

谢谢,

詹姆士

4

1 回答 1

1

就像是

RewriteRule ^directory/listings/(.*)-2/$ http://www.example.com/directory/listings/$1/ [R]
于 2013-03-12T11:18:59.133 回答