[thelist] Automated testing of hundreds of redirects

Phil Turmel philip at turmel.org
Fri Apr 22 14:43:25 CDT 2011

Hi Matt,

On 04/22/2011 12:41 PM, Matt Warden wrote:
> We are changing the URLs for a large number of pages to be more SEO
> friendly. I need to create an automated test to verify hundreds of
> redirects from the old URL to the new URL. I have these mappings in
> Excel, so generating assertions would be trivial.
> The ideal situation would be where I can call the old URL, inspect the
> Location header returned, and then ensure it is as specified in the
> Excel mapping.
> If I can't do that, then I could wget (or similar) each old and new
> URL and compare the length of the response of each pair within some
> small range (because there could be a small amount of dynamic content,
> so I can't do a strict diff). This seems messy.

curl --head http://turmel.org/ 2>/dev/null \
	|grep '^Location:' \
	|cut -d\  -f2-

> My question: what is the best way to do this? It smells to me like a
> task that could be very trivial or very tedious depending on the
> approach I choose.

bash script with something like the above, fed from a text file w/ "oldurl" "newurl" on each line.

> Thoughts would be appreciated.
> Happy Easter,

Thanks.  Happy Easter to you as well.



More information about the thelist mailing list