I tried to find a way to use wget to register a list of redirected website URLs in a single file. For instance:
www.website.com/1234 now redirected to www.newsite.com/a2as4sdf6nonsense
and
www.website.com/1235 now redirected to www.newsite.com/ab6haq7ah8nonsense
Wget displays a redirect, but does not register a new location. I get this in terminal:
HTTP request sent, awaiting response...301 moved permanently Location: http.www.newsite.com/a2as4sdf6
...
I would just write this new url to a file.
I used something like this:
for i in `seq 1 9999`; do wget http://www.website.com/$i -O output.txt done
But this outputs the source code of each web page to this file. I'm trying to just get redirect information only. In addition, I would like to add a new line to the same output file every time it receives a new URL.
I would like the output to look something like:
www.website.com/1234 www.newsite.com/a2as4sdf6nonsense www.website.com/1235 www.newsite.com/ab6haq7ah8nonsense
...
source share