Tatsächliche HTTP Weiterleitung (Redirect) einer Domain mit WGET überprüfen

Eine größere Anzahl Weiterleitungen kann man auch mit einem Script mit der WGET.EXE überprüfen.

  • Benötigt wird eine Liste der Domains als DOMAINS.TXT.
  • Die heruntergeladenen Dateien landen im Unterverzeichnis Downloads
  • Das Logfile heißt REDIRECT.TXT
@echo off
ECHO TATSÄCHLICHE WEITERLEITUNGEN ÜBERPRÜFEN
MKDIR DOWNLOADS
for /f %%i in ('type DOMAINS.TXT') do wget %%i --append-output=REDIRECT.TXT --directory-prefix=DOWNLOADS

Auszug aus dem Logile:

--2016-10-20 09:00:55--  http://38-radiowolfsburg.de/
Resolving 38-radiowolfsburg.de... 62.116.130.8
Connecting to 38-radiowolfsburg.de|62.116.130.8|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.radio38.de [following]
--2016-10-20 09:00:55--  http://www.radio38.de/
Resolving www.radio38.de... 87.230.102.30
Connecting to www.radio38.de|87.230.102.30|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html.1082'

Und so ist es zu verstehen:

Checke Umleitung http://38-radiowolfsburg.de

--2016-10-20 09:00:55--  http://38-radiowolfsburg.de/
Resolving 38-radiowolfsburg.de... 62.116.130.8

 

Verbunden mit http://38-radiowolfsburg.de (Umleitungsserver)

Connecting to 38-radiowolfsburg.de|62.116.130.8|:80... connected.

 

Seite wird wirklich umgeleitet ..( Moved Permanently)

HTTP request sent, awaiting response... 301 Moved Permanently

Das neue Ziel (beginnt mit Location) ist http://www.radio38.de

Location: http://www.radio38.de [following]

Baue Verbindung zu http://www.radio38.de ….

--2016-10-20 09:00:55--  http://www.radio38.de/
Resolving www.radio38.de... 87.230.102.30

Verbunden mit www.radio38.de

Connecting to www.radio38.de|87.230.102.30|:80... connected
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html.1082'

 

Wenn Seiten auf HTTPS Seiten weitergeleitet werden, kann es zum Problem bei check des Zertifikates kommen. In diesem Fall sollte man das WGET um den Parameter –no-check-certificate ergänzen

for /f %%i in ('type DOMAINS.TXT') do wget %%i --append-output=REDIRECT.TXT --directory-prefix=DOWNLOADS -no-check-certificate
--2016-10-20 09:01:02--  http://abo38.de/
Resolving abo38.de... 62.116.130.8
Connecting to abo38.de|62.116.130.8|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.braunschweiger-zeitung.de/leserservice/abo-bestellung/ [following]
--2016-10-20 09:01:02--  https://www.braunschweiger-zeitung.de/leserservice/abo-bestellung/
Resolving www.braunschweiger-zeitung.de... 149.221.201.123
Connecting to www.braunschweiger-zeitung.de|149.221.201.123|:443... connected.
ERROR: cannot verify www.braunschweiger-zeitung.de's certificate, issued by `/C=US/O=GeoTrust Inc./CN=GeoTrust EV SSL CA - G4':
  Unable to locally verify the issuer's authority.
To connect to www.braunschweiger-zeitung.de insecurely, use `--no-check-certificate'.