问题描述
今天突然发现有个域名反代了这个站,就很荣幸啊,没想到我这个站这么火了哈哈哈哈。

看起来像是php反代程序,并不好用,文章页面都打不开,还不如用nginx反代加关键字替换。
这里简单写个nginx反代配置。
server {
listen 443 ssl;
server_name yourdomain;
ssl_certificate cert.cer;
ssl_certificate_key cert.key;
location / {
proxy_pass https://blog.imea.me;
subs_filter_types text/html text/css text/xml;
subs_filter blog.imea.me yourdomain;
}
}
解决方案
写个js,判断当前域名是否正确,然后跳转到正确的域名。
if(window.location.host !== "blog.imea.me"){
window.location.href = "https://blog.imea.me?from=" + window.location.host
}
文章评论