ورڈپریس بیرونی لنکس کو اندرونی لنکس میں کیسے تبدیل کرتا ہے؟مضمون کا بیرونی لنک خود بخود اندرونی لنک کوڈ میں تبدیل ہو جاتا ہے۔

WordPressبیرونی روابط کو اندرونی روابط میں کیسے تبدیل کیا جائے؟

مضمون کا بیرونی لنک خود بخود اندرونی لنک کوڈ میں تبدیل ہو جاتا ہے۔

کبھی کبھی ہم گوگل کرتے ہیں۔SEOورڈپریس ویب سائٹ پر چینی نیٹ ورک کی طرف سے بلاک کر دیے گئے کچھ بیرون ملک ویب سائٹس یا فورمز کی درجہ بندی، اشتراک کرنا، ایسے لنکس کے بلاک ہونے کا خطرہ ہوتا ہے۔

اس لیے ہمیں مضمون میں کچھ بیرونی روابط کو خود بخود اندرونی روابط میں تبدیل کرنے کی ضرورت ہے۔

بیرونی روابط کو اندرونی روابط میں تبدیل کرنے کا فائدہ

  • سیکیورٹی سخت: بدنیتی پر مبنی درخواستوں کے خلاف سادہ تحفظ کو بہتر بنائیں۔
  • جمپ موڈ: HTML js جمپ موڈ کو بڑھانے کے لیے noscript ٹیگ استعمال کریں۔
  • چھلانگ انکرپشن: بیس 64 انکرپٹڈ ایکسٹرنل چین، نان انکرپٹڈ جمپ کے ساتھ ہم آہنگ؛
  • شامل کرنا منع ہے: ایک میٹا بیان شامل کیا گیا جس میں سرچ انجن مکڑیوں کو شامل کرنے اور پکڑنے سے منع کیا گیا ہے۔
  • ممنوعہ استعمال: دوسری سائٹس کو ہمارے ری ڈائریکٹ صفحات استعمال کرنے سے منع کریں۔

مرحلہ 1: فائل کو ویب سائٹ کی روٹ ڈائرکٹری میں اپ لوڈ کریں۔

کوڈ کے 2 ورژن ہیں جو خود بخود ورڈپریس مضامین کے بیرونی لنکس کو اندرونی لنکس میں تبدیل کر دیتے ہیں:

  1. پی ایچ پی ورژن
  2. جے ایس ورژن

پی ایچ پی ورژن

درج ذیل پی ایچ پی کوڈ کو بطور go.php محفوظ کریں اور اسے ویب سائٹ کی روٹ ڈائرکٹری میں اپ لوڈ کریں۔

<?
php
if(strlen($_SERVER['REQUEST_URI']) > 255 ||
 strpos($_SERVER['REQUEST_URI'], "eval(") ||
 strpos($_SERVER['REQUEST_URI'], "base64")) {
 @header("HTTP/1.1 414 Request-URI Too Long");
 @header("Status: 414 Request-URI Too Long");
 @header("Connection: Close");
 @exit;
}
//通过QUERY_STRING取得完整的传入数据,然后取得url=之后的所有值,兼容性更好
$t_url = preg_replace('/^url=(.*)$/i','$1',$_SERVER["QUERY_STRING"]);
//此处可以自定义一些特别的外链,不需要可以删除以下5行
if($t_url=="chenweiliang" ) {
 $t_url="https://www.chenweiliang.com/";
} elseif($t_url=="etufo") {
 $t_url="https://www.etufo.org/";
}
//数据处理
if(!empty($t_url)) {
 //判断取值是否加密
 if ($t_url == base64_encode(base64_decode($t_url))) {
 $t_url = base64_decode($t_url);
 }
 //对取值进行网址校验和判断
 preg_match('/^(http|https|thunder|qqdl|ed2k|Flashget|qbrowser):\/\//i',$t_url,$matches);
 if($matches){
 $url=$t_url;
 $title='页面加载中,请稍候...';
 } else {
 preg_match('/\./i',$t_url,$matche);
 if($matche){
 $url='http://'.$t_url;
 $title='页面加载中,请稍候...';
 } else {
 $url = 'http://'.$_SERVER['HTTP_HOST'];
 $title='参数错误,正在返回首页...';
 }
 }
} else {
 $title = '参数缺失,正在返回首页...';
 $url = 'http://'.$_SERVER['HTTP_HOST'];
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow" />
<noscript><meta http-equiv="refresh" content="1;url='<?php echo $url;?>';"></noscript>
<script>
function link_jump()
{
 //禁止其他网站使用我们的跳转页面
 var MyHOST = new RegExp("<?php echo $_SERVER['HTTP_HOST']; ?>");
 if (!MyHOST.test(document.referrer)) {
 location.href="http://" + MyHOST;
 }
 location.href="<?php echo $url;?>";
}
//延时1S跳转,可自行修改延时时间
setTimeout(link_jump, 1000);
//延时50S关闭跳转页面,用于文件下载后不会关闭跳转页的问题
setTimeout(function(){window.opener=null;window.close();}, 50000);
</script>
<title><?php echo $title;?></title>
<style type="text/css">
body{background:#555}.loading{-webkit-animation:fadein 2s;-moz-animation:fadein 2s;-o-animation:fadein 2s;animation:fadein 2s}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-o-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}.spinner-wrapper{position:absolute;top:0;left:0;z-index:300;height:100%;min-width:100%;min-height:100%;background:rgba(255,255,255,0.93)}.spinner-text{position:absolute;top:45%;left:50%;margin-left:-100px;margin-top:2px;color:#000;letter-spacing:1px;font-size:20px;font-family:Arial}.spinner{position:absolute;top:45%;left:50%;display:block;margin-left:-160px;width:1px;height:1px;border:20px solid rgba(255,0,0,1);-webkit-border-radius:50px;-moz-border-radius:50px;border-radius:50px;border-left-color:transparent;border-right-color:transparent;-webkit-animation:spin 1.5s infinite;-moz-animation:spin 1.5s infinite;animation:spin 1.5s infinite}@-webkit-keyframes spin{0%,100%{-webkit-transform:rotate(0deg) scale(1)}50%{-webkit-transform:rotate(720deg) scale(0.6)}}@-moz-keyframes spin{0%,100%{-moz-transform:rotate(0deg) scale(1)}50%{-moz-transform:rotate(720deg) scale(0.6)}}@-o-keyframes spin{0%,100%{-o-transform:rotate(0deg) scale(1)}50%{-o-transform:rotate(720deg) scale(0.6)}}@keyframes spin{0%,100%{transform:rotate(0deg) scale(1)}50%{transform:rotate(720deg) scale(0.6)}}
</style>
</head>
<body>
<div class="loading">
 <div class="spinner-wrapper">
 <span class="spinner-text">页面加载中,请稍候...</span>
 <span class="spinner"></span>
 </div>
</div>
</body>
</html>

جے ایس ورژن

درج ذیل جے ایس کوڈ کو بطور go.html محفوظ کریں اور اسے ویب سائٹ کی روٹ ڈائرکٹری میں اپ لوڈ کریں۔

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow" />
<script>
//base64加密解密函数
var base64EncodeChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var base64DecodeChars=new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);function base64encode(str){var out,i,len;var c1,c2,c3;len=str.length;i=0;out="";while(i<len){c1=str.charCodeAt(i++)&255;if(i==len){out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt((c1&3)<<4);out+="==";break}c2=str.charCodeAt(i++);if(i==len){out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt(((c1&3)<<4)|((c2&240)>>4));out+=base64EncodeChars.charAt((c2&15)<<2);out+="=";break}c3=str.charCodeAt(i++);out+=base64EncodeChars.charAt(c1>>2);out+=base64EncodeChars.charAt(((c1&3)<<4)|((c2&240)>>4));out+=base64EncodeChars.charAt(((c2&15)<<2)|((c3&192)>>6));out+=base64EncodeChars.charAt(c3&63)}return out}function base64decode(str){var c1,c2,c3,c4;var i,len,out;len=str.length;i=0;out="";while(i<len){do{c1=base64DecodeChars[str.charCodeAt(i++)&255]}while(i<len&&c1==-1);if(c1==-1){break}do{c2=base64DecodeChars[str.charCodeAt(i++)&255]}while(i<len&&c2==-1);if(c2==-1){break}out+=String.fromCharCode((c1<<2)|((c2&48)>>4));do{c3=str.charCodeAt(i++)&255;if(c3==61){return out}c3=base64DecodeChars[c3]}while(i<len&&c3==-1);if(c3==-1){break}out+=String.fromCharCode(((c2&15)<<4)|((c3&60)>>2));do{c4=str.charCodeAt(i++)&255;if(c4==61){return out}c4=base64DecodeChars[c4]}while(i<len&&c4==-1);if(c4==-1){break}out+=String.fromCharCode(((c3&3)<<6)|c4)}return out}function utf16to8(str){var out,i,len,c;out="";len=str.length;for(i=0;i<len;i++){c=str.charCodeAt(i);if((c>=1)&&(c<=127)){out+=str.charAt(i)}else{if(c>2047){out+=String.fromCharCode(224|((c>>12)&15));out+=String.fromCharCode(128|((c>>6)&63));out+=String.fromCharCode(128|((c>>0)&63))}else{out+=String.fromCharCode(192|((c>>6)&31));out+=String.fromCharCode(128|((c>>0)&63))}}}return out}function utf8to16(str){var out,i,len,c;var char2,char3;out="";len=str.length;i=0;while(i<len){c=str.charCodeAt(i++);switch(c>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:out+=str.charAt(i-1);break;case 12:case 13:char2=str.charCodeAt(i++);out+=String.fromCharCode(((c&31)<<6)|(char2&63));break;case 14:char2=str.charCodeAt(i++);char3=str.charCodeAt(i++);out+=String.fromCharCode(((c&15)<<12)|((char2&63)<<6)|((char3&63)<<0));break}}return out}function doit(){var f=document.f;f.output.value=base64encode(utf16to8(f.source.value));f.decode.value=utf8to16(base64decode(f.output.value))};
//获取请求参数,支持伪静态
function GetQueryString(name)
{
 var reg = new RegExp("(^|&)"+ name +"=(.*)$");
 var r = window.location.search.substr(1).match(reg);
 if(r!=null) {
 return unescape(r[2]);
 } else {
 return window.location.pathname.replace('/go/',''); //注意代码中的/goto/和跳转地址/goto/保持一致,请记得自行修改!
 }
}
var jump_url = GetQueryString("url");
//若传入的是base加密数据,则进行解密处理
if( jump_url==base64encode(base64decode(jump_url))) {
 jump_url = base64decode(jump_url);
}
//url简单正则
var UrlReg = "^((http|https|thunder|qqdl|ed2k|Flashget|qbrowser|ftp|rtsp|mms)://)";
//自定义一些跳转字符串,请根据实际需求自行发挥
if(jump_url=="chenweiliang") {
 var jump_url="https://www.chenweiliang.com/";
}
if(jump_url=="etufo") {
 var jump_url="https://www.etufo.org/";
}
//网址校验
if(jump_url == null || jump_url.toString().length<1 || !jump_url.match(UrlReg)) {
 document.title = '参数错误,正在返回首页...';
 jump_url = location.origin;
}
//延时执行跳转
setTimeout(
function link_jump()
{
//非本站域名不允许使用此跳转页面,请自行修改chenweiliang.com为自己的域名
 var MyHOST = new RegExp("chenweiliang.com");
 if (!MyHOST.test(document.referrer)) {
 location.href = "http://" + MyHOST;
 return;
 }
 location.href = jump_url;
}, 1000);
setTimeout(function(){window.opener=null;window.close();}, 50000);
</script>
<title>页面加载中,请稍候...</title>
<style type="text/css">
body{background:#555}.loading{-webkit-animation:fadein 2s;-moz-animation:fadein 2s;-o-animation:fadein 2s;animation:fadein 2s}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-o-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}.spinner-wrapper{position:absolute;top:0;left:0;z-index:300;height:100%;min-width:100%;min-height:100%;background:rgba(255,255,255,0.93)}.spinner-text{position:absolute;top:45%;left:50%;margin-left:-100px;margin-top:2px;color:#000;letter-spacing:1px;font-size:20px;font-family:Arial}.spinner{position:absolute;top:45%;left:50%;display:block;margin-left:-160px;width:1px;height:1px;border:20px solid rgba(255,0,0,1);-webkit-border-radius:50px;-moz-border-radius:50px;border-radius:50px;border-left-color:transparent;border-right-color:transparent;-webkit-animation:spin 1.5s infinite;-moz-animation:spin 1.5s infinite;animation:spin 1.5s infinite}@-webkit-keyframes spin{0%,100%{-webkit-transform:rotate(0deg) scale(1)}50%{-webkit-transform:rotate(720deg) scale(0.6)}}@-moz-keyframes spin{0%,100%{-moz-transform:rotate(0deg) scale(1)}50%{-moz-transform:rotate(720deg) scale(0.6)}}@-o-keyframes spin{0%,100%{-o-transform:rotate(0deg) scale(1)}50%{-o-transform:rotate(720deg) scale(0.6)}}@keyframes spin{0%,100%{transform:rotate(0deg) scale(1)}50%{transform:rotate(720deg) scale(0.6)}}
</style>
</head>
<body>
<div class="loading">
 <div class="spinner-wrapper">
 <span class="spinner-text">页面加载中,请稍候...</span>
 <span class="spinner"></span>
 </div>
</div>
</body>
</html>

براہ کرم ترمیم کو نوٹ کریں://اس جمپ ​​پیج کو اس سائٹ کے علاوہ ڈومین ناموں کے لیے استعمال کرنے کی اجازت نہیں ہے، براہ کرم chenweiliang.com کو اپنے ڈومین نام میں تبدیل کریں۔

کون سا بہتر ہے، پی ایچ پی یا جے ایس؟

پی ایچ پی ورژن اور جے ایس ورژن کے افعال ایک جیسے ہیں، فرق یہ ہے:

  • پی ایچ پی ورژن متحرک ہے اور تھوڑا سا سرور بوجھ پیدا ہوتا ہے۔
  • اور جے ایس ورژن کے لیے براؤزر کو جے ایس کو درست طریقے سے کام کرنے کے لیے سپورٹ کرنے کی ضرورت ہے،
  • لیکن اب، زیادہ تر براؤزر اس کی حمایت کرتے ہیں!

نوٹ: اگر ٹیسٹ جے ایس ورژن کا جمپ کوڈ غلط ہے تو پی ایچ پی کا جمپ کوڈ استعمال کریں۔

مرحلہ 2: function.php فائل میں کوڈ شامل کریں۔

جمپ پیج اپ لوڈ کرنے کے بعد، اگلا مرحلہ ورڈپریس تھیم کی function.php فائل میں ایکسٹرنل لنک جمپ کوڈ شامل کرنا ہے۔

2 سے 1 کوڈ:

  • 1) بغیر خفیہ کاری کے بیرونی لنک جمپ
  • 2) بیرونی لنک جمپ بیس 64 انکرپشن [تجویز کردہ]

خفیہ کاری کے بغیر بیرونی لنک جمپ

// 外链跳转无加密go.html?url
add_filter('the_content','link_to_jump',999);
 function link_to_jump($content){
 preg_match_all('/<a(.*?)href="(.*?)"(.*?)>/',$content,$matches);
 if($matches){
 foreach($matches[2] as $val){
 if(strpos($val,'://')!==false && strpos($val,home_url())===false && strpos($val,'chenweiliang.com')===false && strpos($val,'ufo.org.in')===false && strpos($val,'etufo.org')===false && !preg_match('/\.(jpg|jepg|png|ico|bmp|gif|tiff)/i',$val) && !preg_match('/(ed2k|thunder|Flashget|flashget|qqdl):\/\//i',$val))
{ 
 $content=str_replace("href=\"$val\"", "rel=\"nofollow\" target=\"_blank\" href=\"go.html?url=$val\" ",$content);

}
 }
 }
 return $content;
 }

بیرونی لنک جمپ بیس 64 انکرپشن [تجویز کردہ]

// 外链跳转base64加密go.html?url
 add_filter('the_content','link_to_jump',999);
 function link_to_jump($content){
 preg_match_all('/<a(.*?)href="(.*?)"(.*?)>/',$content,$matches);
 if($matches){
 foreach($matches[2] as $val){
 if(strpos($val,'://')!==false && strpos($val,home_url())===false && strpos($val,'chenweiliang.com')===false && strpos($val,'ufo.org.in')===false && strpos($val,'etufo.org')===false && !preg_match('/\.(jpg|jepg|png|ico|bmp|gif|tiff)/i',$val) && !preg_match('/(ed2k|thunder|Flashget|flashget|qqdl):\/\//i',$val))
{ 
 $content=str_replace("href=\"$val\"", "rel=\"nofollow\" target=\"_blank\" href=\"go.html?url=" .base64_encode($val). "\" ",$content);

}
 }
 }
 return $content;
 }

خارجی لنک کے ڈومین نام کی وضاحت کو خود بخود اندرونی لنک میں تبدیل نہ ہونے سے خارج کرتا ہے (ڈومین ناموائٹ لسٹ):

&& strpos($val,'你的域名')===false

robots.txt مکڑیوں کو روکتا ہے۔

سرچ انجن مکڑیوں کو جمپ لنکس کو رینگنے سے روکنے کے لیے، ہم ایسے قوانین شامل کر سکتے ہیں جو سرچ انجن مکڑیوں کو robots.txt فائل میں رینگنے سے منع کرتے ہیں:

User-agent: *
Disallow: /go.html?url=*
Disallow: /go.php?url=*

یہ مضمون ختم نہیں ہوا، براہ کرم "توسیع شدہ پڑھنا" پڑھنا جاری رکھیں

پڑھنے میں توسیع:

ہوپ چن ویلیانگ بلاگ ( https://www.chenweiliang.com/ ) کا اشتراک کیا گیا "ورڈپریس بیرونی لنکس کو اندرونی لنکس میں کیسے تبدیل کرتا ہے؟مضمون کا بیرونی لنک خود بخود اندرونی لنک کوڈ میں تبدیل ہو جاتا ہے"، جو آپ کے لیے مفید ہے۔

اس مضمون کا لنک شیئر کرنے میں خوش آمدید:https://www.chenweiliang.com/cwl-629.html

تازہ ترین اپ ڈیٹس حاصل کرنے کے لیے چن ویلیانگ کے بلاگ کے ٹیلیگرام چینل میں خوش آمدید!

🔔 چینل ٹاپ ڈائرکٹری میں قیمتی "ChatGPT Content Marketing AI Tool Usage Guide" حاصل کرنے والے پہلے فرد بنیں! 🌟
📚 یہ گائیڈ بہت بڑی قیمت پر مشتمل ہے، 🌟یہ ایک نادر موقع ہے، اس سے محروم نہ ہوں! ⏰⌛💨
پسند آئے تو شیئر اور لائک کریں!
آپ کا اشتراک اور پسندیدگی ہماری مسلسل حوصلہ افزائی ہے!

 

评论 评论

آپ کا ای میل ایڈریس شائع نہیں کیا جائے گا۔ ضروری شعبوں کا استعمال کیا جاتا ہے * لیبل لگائیں

اوپر سکرول کریں