Talking about how to pass. htaccess Set picture file anti-theft chain

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Hello everybody, I am the kiness of Hunan push. Now the Internet is the original content of the phenomenon of plagiarism is too common, we have spent a lot of webmaster time to write an article out, at the bottom of the article also added the copyright. After being reprinted, the content is basically reserved, the copyright text is really missing, even more, the copyright writer became someone else. This is to let a person very wohuo, angry, oneself painstakingly writes the thing to be somebody else that a few words, replace to link, become others ' original work. This time, I talk about how to set up a picture file Anti-Theft chain method through the htaccess file, hoping to help the webmaster friends in this area.

To prevent the image file is collected, first of all we have to ensure that search engine spiders and visitors to the site can normally see picture files. The code is as follows:]

<files ~ "^. (HTACCESS|HTPASSWD) $ >
Deny from all
</Files>
Order Deny,allow
Rewriteengine on
Rewritecond%{http_referer}!^$
Rewritecond%{http_referer}!^http://(www\.)? Baidu.com (/)? *$ [NC]
Rewritecond%{http_referer}!^http://(www\.)? google.com (/)? *$ [NC]
Rewritecond%{http_referer}!^http://(www\.)? Domain.com (/)? *$ [NC]

The "baidu.com" "google.com" "domain.com" in the code above is a domain name that allows access to the images that are prevented from being collected. This inside webmaster Friend reference Code, set itself. For example, want to let Yahoo, SOSO, Sogou and other search engines normal access to the words copy "Rewritecond%{http_referer}!^http://(www\.)? Domain.com (/)? *$ [NC] "This piece of code, replace to domain.com in it. Another important place to remember is to add your own domain name. Method is the same as above.

Once you've set it up, we're going to consider replacing the picture next. Why should I replace the picture? When we set up the picture file to prevent collection, but after the content is collected, we want to let the picture display the replacement picture. Although this paragraph is a bit clumsy, but I believe in webmaster industry friends, this understanding of the ability to have. The code is as follows:

Rewriterule *\. (gif|jpg|jpeg|bmp|png) $ http://www.xxx.com/photo.jpg [r,nc,l]

Replace the code above with the correct path to replace the picture. Here also need to note that the replacement picture must not be your current domain file! Suggest making a picture of another website. If you set the picture in your domain name, it will cause a dead loop. Please remember this point to the webmaster friends.

Then the complete code comes out. Follows:

<files ~ "^. (HTACCESS|HTPASSWD) $ >
Deny from all
</Files>
Order Deny,allow
Rewriteengine on
Rewritecond%{http_referer}!^$
Rewritecond%{http_referer}!^http://(www\.)? Baidu.com (/)? *$ [NC]
Rewritecond%{http_referer}!^http://(www\.)? google.com (/)? *$ [NC]
Rewritecond%{http_referer}!^http://(www\.)? Domain.com (/)? *$ [NC]
Rewriterule *\. (gif|jpg|jpeg|bmp|png) $ http://www.xxx.com/photo.jpg [r,nc,l]

After copying the code, paste it into WordPad and name it a. htaccess file. Generally local is not supported by this file name, then you can upload the Web site through FTP to the root directory, and then name the file as. htaccess. htaccess set the way of the picture anti-theft chain that's it.

Finally, this article from Hunan push (original http://www.hntui.com/jingyan/31.html) Webmaster kiness Original, reproduced please be sure to indicate the source, the niche is appreciated, thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.