Download file with permissions intact python urllib
What you need is a database containing two columns: OriginalURL (with real physical URLs) and SEO_URL (with pretty SEO-friendly links). Security-Exposed.com, Yuriy Stanchev, Security and penetration testing, tech blog.