Implemented solution to php redirect problem