fixed user agent for redirect script

Made redirection more sophisticated, will increase the counter only if
user agent is known