Fixed internal redirect problems for when a script_name is being used.