While you can fix this with an iRule, I would suggest that you don't when the LTM has the ability baked in. Try updating your applied HTTP Profile.
Login to the Management Console, navigate to your HTTP Profile and then go to the upper left and select the "Help" Tab. It will display a description of each HTTP Profile Option and explain what each option does.
Look for "Redirect Rewrite". The "Matching" option should resolve your issue.
Matching: Specifies that the system rewrites the URI in any HTTP redirect responses that match the request URI.