Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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:

<?php
$url = "http://www.yoururltotest.tld/";
$headers = get_headers($url,1);
print_r($headers);
?>

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

share|improve this answer
add comment

Your Answer

 
discard

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.