Properly Handling Qiniu Cloud Image Acceleration to Avoid Website Ranking Downgrade

Publish: 2014-12-09 | Modify: 2014-12-08

Introduction

The free 10GB traffic and storage of Qiniu Cloud Storage is quite attractive. It not only reduces the server load but also improves website speed, which has attracted a large number of users. However, some users have reported that their websites may be downgraded after using Qiniu Cloud.

But as long as we handle Qiniu's image acceleration correctly, we can completely avoid this situation. I have summarized a small guide based on online methods. Let's take a look at how to implement it specifically.

1. robots.txt file

The official method is to upload the robots.txt file to the bucket (space) to prohibit spider crawling. Qiniu uses this template by default, so there is generally no need to modify it.

2. Bind your own subdomain

By default, Qiniu provides us with a subdomain. However, there have been cases where it was reported as a dangerous website by 360 antivirus software. The reason may be that the majority of users use Qiniu's subdomain, causing it to be too common. I suggest binding your own subdomain in Qiniu space (you need to have a filing record, if you don't have one, borrow a filing record subdomain from a friend). qiniubangding

3. Block through UserAgent

This is a more important step. This method is provided by V7V3. We can block the Qiniu mirror crawler from crawling webpage files through UserAgent. It is a reasonable solution. Add the following code to the index.php file in the root directory of the website or add it to the functions.php file in the theme directory.

if (strpos($_SERVER['HTTP_USER_AGENT'], 'qiniu-imgstg-spider') !== false) {
    header('HTTP/1.1 503 Service Temporarily Unavailable');
    echo '防七牛镜像';
    exit;
}

4. Additional instructions

If your WordPress website uses the WP Super Cache plugin, please add Qiniu's user agent to the denied cache list. Go to Settings -> WP Super Cache -> Advanced -> Find Denied User Agents -> Add qiniu-imgstg-spider, as shown in the screenshot below. qiniu

Conclusion

After completing step 3, let's delete the Qiniu cache and then access the website again. It should return a 503 error, indicating that it was successful. For example, visit the domain name bound to Qiniu by Xiaoz: pic.bsdev.cn qiniu503

The source of steps 3 and 4 is from: 如何最合理的处理七牛cdn镜像加速功能造成的网站被镜像问题


Comments