PHP代码在单独的页面上显示搜索结果

I tried for a while now to find some code on the INternet which I can put inside my search.php file which i created to show all search results on that specific page and not on the default wordpress search site, but didn´t found anything that fits my problem.

I have tried several codes withing my search.php file but they either crashed my site or didn´t worked the way i need it

<?php get_header(); ?>

    <?php echo do_shortcode('[et_pb_section global_module="4027"][/et_pb_section]'); ?>


    <?php if (have_posts()) : ?>
                <?php while (have_posts()) : the_post(); ?>
<div class="searchResults">
 <a href="<?php the_permalink() ?>">
   <h2><?php the_title(); ?></h2>
 </a>
 <p><?php the_excerpt(); ?></p>
</div>
 <?php endwhile; ?>

 <?php else : ?>

 <?php _e( 'Nothing Found' ); ?>
 <?php endif; ?>


<?php

get_footer();

This is some of what I have tried: (taken from comments)

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="searchResults">
    <a href="<?php the_permalink() ?>"> 
    <h2><?php the_title(); ?></h2></a>
    <p><?php the_excerpt(); ?></p>
</div>
<?php endwhile; ?>
<?php else : ?>
<?php _e( 'Nothing Found' ); ?>
<?php endif; ?>