mod_rewritereplace字符

我知道这应该是世界上最简单的事情,但我不能轻易改写,而且我不得不这样做,所以我最终拖延了Google几个小时。

我正在将两个WordPress博客合并到一个新的博客中。 唉,他们都有不同的永久链接结构。

我能想到的最好的办法是将不太受欢迎的两个redirect到新的searchfunction – 但是我已经陷入了最后的障碍:我需要将URL中所有的连字符replace为正值符号。

  • 旧url: http : //www.myoldblogurl.com/2011/01/02/the-title-of-the-blog
  • 期望的url: http ://www.mynewblogurl.com/blog/?s=the+title+of+the+blog

我有什么是这样的:

RedirectMatch permanent /[0-9]{4}/[0-9]{2}/([a-z0-9\-]+) http://www.mynewblogurl.com/blog/?s=$1 

这将给我: http : //www.mynewblogurl.com/blog/?s= the-title-of-the- blog

我只需要find一种方法来将这些连字符变成加号。

你正试图在重写规则中使用正则expression式来进行search/replace,这是不可能的。 您可以在前面的问题中看到一些潜在的解决方法