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:

I need an assistant.

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


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

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

// Check referrer


$refData = parse_url($ref);

if($refData['host'] == '' || $refData['host'] == ''  ) {

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=''></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.

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