Last active
February 16, 2017 13:04
-
-
Save HarryR/1cf567db89b82cff66eaab719ffa02e2 to your computer and use it in GitHub Desktop.
Check domain for HTTP/HTTPS redirects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
check_domain () { | |
local DOMAIN=$1 | |
local LOCATION=`curl -vq -o /dev/null http://$DOMAIN/ &> /dev/stdout | grep Location:` | |
curl -vq -o /dev/null https://$DOMAIN/ &> /dev/null | |
echo -n "$DOMAIN " | |
OK=$? | |
if [[ $OK -eq 0 ]]; then | |
echo -n "HAS-HTTPS" | |
else | |
echo -n "NO-HTTPS" | |
fi | |
echo $LOCATION | grep "https://$DOMAIN/" &> /dev/null | |
OK=$? | |
if [[ $OK -eq 0 ]]; then | |
echo -n " HTTPS-REDIRECT " | |
fi | |
echo " $LOCATION" | |
} | |
for DOMAIN in $* | |
do | |
check_domain $DOMAIN | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment