htaccess将具有{{link}}的所有链接重定向到没有该字符串的相同链接

htaccess将具有{{link}}的所有链接重定向到没有该字符串的相同链接

问题描述:

From some unknown reason, Google has indexed many pages on my website with a weird {{link}} as part of the url. Most of the times it is a copy of the same page without that weird string, but this duplicated content is concerning.

How can I redirect all urls that include the string "{{link}}" to the same url, just without the {{link}} ?

由于某些未知原因,Google已将我网站上的许多网页编入索引,其中包含一些奇怪的{{link}}。 网址。 大多数情况下,它是同一页面的副本,没有那个奇怪的字符串,但这个重复的内容是有关的。 p>

如何重定向包含字符串“{{link}”的所有网址。 “到同一个网址,只是没有{{link}}? p> div>

Try this .htaccess:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/\{\{link\}\}\_(.*)$ /$1/$2 [R=301,L]