How to redirect my custom template page to content-none.php if no posts found?

Farhan, this should do it, add an else to the if statement:

$args = [
    'post_type' => 'post',
    'posts_per_page' => 1000
];
$q = new WP_Query($args);
if ( $q->have_posts() ) {
    while ( $q->have_posts() ) {
        $q->the_post();
        ?>
        <p>The posts styling goes here</p>
        <?php
    }
    // cleanup after the query
    wp_reset_postdata();
} else {
    ?>
    <p>Content I want to show if no posts found.</p>
    <?php
    // You could load a sub-template/partial here, e.g.:
    // get_template_part( 'content', 'none' );
    // it won't replace the entire template though
}

error code: 523