URL跳转时默认对搜索引擎访问使用301,以提升SEO效果

This commit is contained in:
刘祥超
2023-04-07 19:19:53 +08:00
parent 7db0c8cf62
commit 0b441021d8
3 changed files with 32 additions and 31 deletions

View File

@@ -15,7 +15,11 @@ import (
"sync/atomic"
)
// 其中的每个括号里的内容都在被引用,不能轻易修改
// 搜索引擎和爬虫正则
var searchEngineRegex = regexp.MustCompile(`(?i)(60spider|adldxbot|adsbot-google|applebot|admantx|alexa|baidu|bingbot|bingpreview|facebookexternalhit|googlebot|proximic|slurp|sogou|twitterbot|yandex)`)
var spiderRegexp = regexp.MustCompile(`(?i)(python|pycurl|http-client|httpclient|apachebench|nethttp|http_request|java|perl|ruby|scrapy|php|rust)`)
// 内容范围正则,其中的每个括号里的内容都在被引用,不能轻易修改
var contentRangeRegexp = regexp.MustCompile(`^bytes (\d+)-(\d+)/(\d+|\*)`)
// 分解Range