0

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?

Spencer
  • 211
  • 1
  • 2
  • 6

1 Answers1

1

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.

user103307
  • 53
  • 3