Refactor .htaccess rules.

Use a separate rule for each necessary redirect action and handle a
couple edge cases.