I am using Apache's mod_rewrite to redirect mobile users to my mobile site based on their http_user_agent. However not all pages have a mobile equivalent. Also mobile pages end in .html and full pages end in .shtml.Here is some pseudo code.Does the user have a certain HTTP_USER_AGENT?Is there a mobile page?If so take them there. If not, no redirection is needed.I want to do this with apache. 
How can I test for a URLs existeance before redirecting to it?
apache;mod rewrite;mobile;apache2