HTTP URL Redirection Command Line Trace

22,352

Try curl -v -L

There are several tools, you can use from the command line, the most well known of which are curl and wget.

With curl you can follow redirects using the flag -L; additionally, you want to see what happens on the way to the final URL so you need -v (verbose):

curl -v -L www.domain.tld

See here for details: http://curl.haxx.se/docs/faq.html

Maybe also set user agent and save to file

For your use case you should probably additionally set the user-agent to some widely used browser - otherwise it could be said, that the redirect only occurs for certain non-browser user-agents. Here I am setting the user agent to Firefox on Windows.

And it is probably better to save the final content into a separate file (here I chose content.out), so you would end up with something like this:

curl -A 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0' -v -o content.out -L www.redirector.tld
Share:
22,352

Related videos on Youtube

Yarsh
Author by

Yarsh

I enjoy writing hardcore OO data-structures in native C++.

Updated on September 18, 2022

Comments

  • Yarsh
    Yarsh almost 2 years

    I have to produce definitive evidence that can be documented on a piece of paper, proving that one URL redirects to another.

    When you browse to the URL in question, the web server responds with an HTTP redirect, which changes the URL in the address bar and sends you to a different URL

    I'm working on a legal case involving web traffic, so the evidence has to be demonstrable on a piece of paper (no video evidence).

    Is there a trace I could perform, showing the HTTP requests and responses on the Windows command line?

    • HBruijn
      HBruijn over 9 years
      Telnet to web port, issue http request , see response...
  • Yarsh
    Yarsh over 9 years
    I hadn't considered the non-browser argument issue. Thanks for pointing that out. :)