I was able to solve the problem by adding a check to see if the query_vars contains post_type.
public function wp_es_pre_get_posts($query) {
if (!empty($query->is_search) && !$this->is_bbPress_search()) {
if (!isset($query->query_vars['post_type']) && !empty($this->WP_ES_settings['post_types'])) {
Here is a way I came up by just changing ur custom error page and then adding a part of code to WordPress.
http://www.nathanm.com/2006/07/02/wordpress-permalinks-removing-indexphp-in-iis.html