[1.9.x] Fixed #26293 -- Fixed CommonMiddleware to process PREPEND_WWW and APPEND_SLASH independently. Backport of 9390da7f from master