[Solved] Codeigniter wrong url to redirect 404


Try this

public function read($slug_posts)
{
    $options    = $this->options_model->listing();

     $posts      = $this->posts_model->read($slug_posts);
     if ( ! $posts) 
     {
         show_404();
     }
     #$listing   = $this->posts_model->home();

     $data = array(  'title'         => $posts->post_title.' – '.$options->option_title,
                     'description'   => $posts->post_description,
                     'posts'         => $posts,
                     #'listing'      => $listing,
                     'content'           =>  'posts/read'
                     );

    $this->load->view('layout/wrapper', $data, FALSE);
}

If truly understand what your question is, this function show the 404 page when there’s no posts based on the slug that you get by the url.

0

solved Codeigniter wrong url to redirect 404