简体   繁体   English

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

[英]htaccess redirect all links that have {{link}} to same link without that string

From some unknown reason, Google has indexed many pages on my website with a weird {{link}} as part of the url. 出于某种未知原因,Google已使用奇怪的{{link}}作为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}} ? 如何在不包含{{link}}的情况下将所有包含字符串“ {{link}}”的URL重定向到相同的URL?

Try this .htaccess: 试试这个.htaccess:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM