'BASH | can not get redirected URL from URL that in CSV file by cURL

I need to get redirected URL from the origin URL that gets in a CSV file, but not as my expect, it only return origin URL, not redirected URL

how can I resolve it?

My code:

#!/bin/bash
array=()
while read -r value ; do
        array+=("$value")
done < test.csv

curl -kIsL -w "%{url_effective}\n" -o /dev/null "${array[0]}"

test.csv:

https://www.chrono24.jp/omega/%25E6%2599%2582%25E8%25A8%2588--id10024378.htm

result log:

https://www.chrono24.jp/omega/%25E6%2599%2582%25E8%25A8%2588--id10024378.htm

expect log:

https://www.chrono24.jp/omega/index.htm


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source