In PHP you can choose a default value if non alphanumeric characters are found, this is much better than trying to remove special characters:
Code:
<?php
$default_id = 1; // Set your default ID
$id = !preg_match('/[a-z0-9]+/i', $value) ? $default_id : $value;
?>
For best performance it's better to set these options:
Code:
MaxKeepAliveRequests 0
MaxRequestsPerChild 0