Update Case closed. I forgot I have a kill function in my functions.php with redirects attachment, search, author, daily archive pages to home. Deleted the part for search and works fine.
Sorry for that, and thank you for your time and help :)
I have a simple search form in wordpress
<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
<label>
<input type="search" class="search-field" placeholder="what are you looking for?" value="" name="s" title="enter search" />
</label>
<input type="submit" class="btn search-submit" value="Search" />
</form>
After I submit the form it redirects to home page. I was trying to change the action to echo home_url( '/search.php' );
but then I get a 404.
I have got the search.php done. The code is
<?php if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title"><?php printf( __( 'Search Results for: %s'), '<span>' . get_search_query() . '</span>' ); ?></h1>
</header>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content'); ?>
<?php endwhile; ?>
<?php else : ?>
<p>no results</p>
<?php endif; ?>
get_search_form()
function, you can refer developer.wordpress.org/reference/functions/get_search_form.get_search_form
only for displaying the form and not the results?get_search_query
function to retrieve all search related queries, you can pick it from any theme if you are having any trouble. You can use github.com/WordPress/WordPress/blob/master/wp-content/themes/… with your modifications.