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?


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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