#!/usr/bin/env bash
# Prints status code and Location header for each URL, one per line.
# Usage: ./redirect-check.sh urls.txt   (one URL per line)
# Run it before the fix, then again after, and screenshot both outputs.
while read -r u; do
  [ -z "$u" ] && continue
  out=$(curl -sI --max-time 15 "$u")
  code=$(printf '%s\n' "$out" | awk '/^HTTP/{c=$2} END{print c}')
  loc=$(printf '%s\n' "$out" | awk 'BEGIN{IGNORECASE=1} /^location:/{print $2}' | tr -d '\r')
  printf '%s  %s  %s\n' "$code" "$u" "${loc:+-> $loc}"
done < "$1"
