简体   繁体   中英

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. 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}} ?

Try this .htaccess:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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