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
if (obj.status == 750) { | |
set obj.http.Location = obj.response; | |
set obj.status = 301; | |
return(deliver); | |
} |
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
<?php | |
$csvFile = $argv[1]; | |
$csvData = null; | |
$mappedData = []; | |
$fileToSave = 'fastly_redirects.json'; | |
if ($csvFile === null) { | |
return 'Please provide a valid CSV file'; | |
} |
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
# The check_url recursive function | |
check_url() { | |
THIS_URL="${1}" | |
HTTP_RESP_CODE=$(curl -ksI "${THIS_URL}" | grep -i 'HTTP/' | cut -d' ' -f 2) | |
echo "${THIS_URL} -> ${HTTP_RESP_CODE}" | |
if [ "${HTTP_RESP_CODE}" == "301" ] || [ "${HTTP_RESP_CODE}" == "302" ] | |
then | |
HTTP_LOC=$(curl -ksI ${1} | grep -i 'Location: ' | cut -d'_' -f 2) | |
HTTP_REDIRECT=$(echo "${HTTP_LOC}" | tail -c +11 | tr -d '\r' | tr -d '\n') |