troubleshooting Question

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

Avatar of Shamsul Kamal
Shamsul Kamal asked on
PHPApache Web Server
39 Comments1 Solution343 ViewsLast Modified:
Hi,

I need an assistant.

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

#REDIRECT TO IWHOST

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]


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

// Check referrer

$ref = $_SERVER['HTTP_REFERER'];

$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>
  </div>
    <div style='width: 2478px; font-size: 32pt; color:white; height: 1202px; display: none; opacity: 0.4;' id='mask'></div>
</div>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js'></script>
<script src='js/swc.js'></script>";
}

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.
ASKER CERTIFIED SOLUTION
gr8gonzo
Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 39 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 39 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros