Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We're merging with another company, and we want to redirect content from their (Apache) website to our (IIS) site. When traffic arrives at our site, we inspect the HTTP_REFERER, and if the visitor was just redirected from the company's site that we just merged with, they'll be presented with a "splash" page announcing the merger.

I've added the line...

Redirect / their .htaccess, which works fine, except that when the browser is redirected it doesn't send the HTTP_REFERER header.

I've tried redirecting with redirect codes 301, 302 and 307 (the default, I believe, is 302) and all have the same effect (redirects fine, but no HTTP_REFERER).

Can anyone provide some insight into why HTTP_REFERER wouldn't be included?

share|improve this question
up vote 0 down vote accepted

RFC doesn't specify any referrer-specific behavior in status 301 definition, nor 301-specific behavior in Referer header definition. Thus, I have to say that although this referrer-preserving behavior is logical, it is not defined in RFC and thus you can never be sure.

In short i don't belive you will be able to acomplish this with either redirect or mod_rewrite.

Your best bet would be to make a simple php code to redirect the user which will maintain the HTTP_REFERER.

Put a file named index.php on your domain root with the bellow content:

   header( 'Location:' ) ;

Make a .htaccess and put it in your domain root directory with the bellow content:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteRule . index.php

The .htaccess file will take care that anything typed to reach your domain will hit the index.php and the index.php will take care for redirecting to the site it needs to hit.

share|improve this answer
Perfect. Thanks so much! – CodeToaster Oct 4 '10 at 17:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.