A Workaround to Twitter's Domain Censorship

Submitted by Tom Thorp on Tuesday, August 18, 2020 - 00:31
Modified on Tuesday, August 18, 2020 - 01:37
Bitchute Censored

Recently, Twitter has ramped up its policy of censoring links to domain names. First it was Bitchute.com, next it was Banned.video . When a user clicked on one of these links, you were greeted with the following screen : 

Twitter Warning Link

Which got me thinking - is there a way to circumvent Twitter's domain name censorship policy. It turns out there is : 

 

Proxy Redirection

If you have a dedicated website and know how to code in PHP, then this will be second nature to you. It is best to dedicate a virtualhost completely separate from any other websites you may be hosting. The last thing you want, is for your main website to be blocked by social media platforms. 

Without further ado, here is the PHP code to add in the root directory of your website : 

<?php
$bc = "https://bitchute.com/video";
$uri = $_SERVER['REQUEST_URI'];
$bcUrl = $bc . $uri;
if (isset($_SERVER['HTTP_USER_AGENT']) && !empty($_SERVER['HTTP_USER_AGENT'])) {
   $agent = $_SERVER['HTTP_USER_AGENT'];
   if (isset($agent) && !empty($agent) && stripos($agent,"Twitterbot") !== false) {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL,$bcUrl);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
      $res = curl_exec($ch);
      curl_close($ch);
      echo $res;
   } else {
      Header("Location: " . $bcUrl);
   }
} else {
    Header("Location: " . $bcUrl);
}

Take particular note of the 'If' block containing "Twitterbot". Its purpose is to stop Twitter from crawling your web server whenever you leave a link back to your webserver. In this case, whenever you want to reference a BitChute video, all you have to do is pass the BitChute video id as a parameter to your hosted domain. 

eg. http://mydomain.com/<bitchute id>

The only downside to this method, is that meta tags (which normally would instruct Twitter to preview the content on a tweet) will not be shown. I am sure the above code can be improved upon by PHP developers to include this feature. All correspondence and suggestions welcome.

 

About the author

Tom Thorp
Tom Thorp is an IT Consultant living in Miami on Queensland's Gold Coast. With over 30+ years working in the IT industry, Tom's experience is a broad canvas. The IT services Tom provides to his clients, includes :
 
Website development and hosting
Database Administration
Server Administration (Windows, Linux, Apple)
PABX Hosting and Administration
Helpdesk Support (end-user & technical).
  If you like any of my content, consider a donation via Crypto by clicking on one of the payment methods :
 
Categories
TwitterCensorshipPHPProxy