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

I am setting up a test server whose primary purpose is to test the scripts we are using for Apache redirectors.

On the test server, I don't want to actually redirect to the page but instead I want to print out the url that on the real server you would have been redirected to.

I am a novice and don't know really where to start in order to achieve this. What should I do?

share|improve this question
up vote 1 down vote accepted

What technology do you have on your test servers?

I'm not sure I've totally understood your question but give a look at PHP's get_headers(), if the user is relocated via non-HTML method, you can try to get the content from the URL of your production server and get its header to retrieve the URL in the header.

Try this:

$url = "http://www.yoururltotest.tld/";
$headers = get_headers($url,1);

Then look at the "Location" header which should be different for each redirections as get_headers does follow HTTP redirections.

share|improve this answer

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.