Avatar of Shamsul Kamal
Shamsul Kamal

asked on 

PHP Referrer not detect if redirect from another domain using .htaccess


I need an assistant.

i made 301 redirection using .htaccess to new domain name as follows :


RewriteCond %{HTTP_HOST} ^domain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteCond %{REQUEST_URI} !/(fpx_indirectcallback|fpx_directcallback|molpay_callback|paypal|billplzBills)\.php [NC]
RewriteRule ^(.*)$ https://iwhost.com/$1 [L,R=301,NC]

Open in new window

and at the iwhost.com i made a php script in index.php as follows :

// Check referrer


$refData = parse_url($ref);

if($refData['host'] == 'domain.com' || $refData['host'] == 'www.domain.com'  ) {

echo "<link rel='stylesheet' href='css/swc.css'>
<div id='boxespopup'>
  <div style='top: 50%; left: 50%; display: none;' id='dialog' class='window'>
    <div id='san'>
      <a href='#' class='close agree'><img src='img/close-icon.png' width='25' style='float:right; margin-right: -25px; margin-top: -20px;'></a>
      <img src='img/notice.jpg'>
    <div style='width: 2478px; font-size: 32pt; color:white; height: 1202px; display: none; opacity: 0.4;' id='mask'></div>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js'></script>
<script src='js/swc.js'></script>";

Open in new window

The problem is that why iwhost receive empty referrer when redirect using the above method.

Please advice alternate method or idea on how to achieve my requirement.
PHPApache Web Server

Avatar of undefined
Last Comment
David Favor

8/22/2022 - Mon