朱纯树博客
VPS测评推荐网站
cloudacead cloudacead

PHP简单防止网站被镜像(反代)代码

php
简单粗暴,不一定能全防(防小白搞的反代还是可以的,某些大佬搞的防不了),如果你有更好的思路但不会用代码描述,您可以评论出来,我们一起解决

<?PHP $domain="zhuchunshu.com";/*网站域名*/ $agreement="https://";#网站协议(http,https) ?>
<?php if ($_SERVER['HTTP_HOST']!=$domain): #如果当前域名不等于$domain变量设置的域名那么则重定向到$domain变量设置的域名 ?>
    <?php header("location:".$agreement.$domain); ?>
<?php endif ?>
赞(0) 打赏
未经允许不得转载:VPS测评推荐网站 - 朱纯树博客 » PHP简单防止网站被镜像(反代)代码

评论 25

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #30

    It’s actually very difficult in this full of
    activity life to listen news on Television, therefore I just use internet for that
    purpose, and get the hottest news.

  2. #29

    Woah! I’m really loving the template/theme of this blog. It’s simple, yet effective.
    A lot of times it’s very hard to get that “perfect balance” between usability
    and visual appeal. I must say that you’ve done a amazing job with this.
    In addition, the blog loads extremely quick for me on Internet explorer.
    Excellent Blog!

  3. #28

    It’s remarkable to pay a quick visit this web site
    and reading the views of all friends on the topic of this piece of
    writing, while I am also zealous of getting knowledge.

  4. #27

    If some one wishes expert view about blogging then i suggest him/her to visit this
    website, Keep up the fastidious job.

    lifeline.news1周前 (08-10)回复
  5. #26

    I am not sure the place you’re getting your info, however good topic.
    I needs to spend a while learning much more or working out
    more. Thank you for excellent info I used to be in search of this info for my mission.

  6. #25

    I love what you guys are up too. This sort of clever work and coverage!
    Keep up the great works guys I’ve added you guys to my blogroll.

  7. #24

    Its like you read my mind! You seem to know a lot about this, like you wrote the
    book in it or something. I think that you can do with some pics
    to drive the message home a bit, but instead of that, this is fantastic blog.
    A great read. I will definitely be back.

  8. #23

    Fantastic web site. Lots of helpful information here. I am sending it
    to several pals ans additionally sharing in delicious.
    And certainly, thank you to your sweat!

    tinyurl.com2周前 (08-02)回复
  9. #22

    It’s in reality a great and useful piece of information. I’m happy that you just shared this helpful info with us.
    Please stay us up to date like this. Thanks for sharing.

    tinyurl.com2周前 (08-01)回复
  10. #21

    Hi there! I’m at work surfing around your blog from my new
    apple iphone! Just wanted to say I love reading through your blog and look forward to all your posts!
    Carry on the excellent work!

    tinyurl.com3周前 (07-28)回复