Welcome Guest, Not a member yet? Register   Sign In
SEO implement?
#5

[eluser]paulc010[/eluser]
A method I've used for news stories (never going to be that many of them, so the limitations are acceptable):

Code:
function post($uri = 1)
    {
        // The $id could be a post_id or a post_slug
        $id=$this->posts_model->get_post_id_from_slug($uri);

        if ($id === 0) :
            // It's not a slug it might be a numeric post id
            $id=$uri;

            // Does the post exist?
            if ($this->posts_model->is_post($id)) :
                // Let's see if we have a nice name for this page
                $slug = $this->posts_model->get_post_slug($id);
                if ($slug != $uri) :
                    redirect(base_url().'news/post/'.$slug, 'location', 301);
                endif;
            endif;
        endif;

        // Get the data and display it
    }

The 'slug' in the post table has to be unique, so you would need to enforce that.....

Paul


Messages In This Thread
SEO implement? - by El Forum - 04-27-2010, 06:39 AM
SEO implement? - by El Forum - 04-27-2010, 07:12 AM
SEO implement? - by El Forum - 04-27-2010, 07:50 AM
SEO implement? - by El Forum - 04-27-2010, 07:58 AM
SEO implement? - by El Forum - 04-27-2010, 08:06 AM
SEO implement? - by El Forum - 04-27-2010, 08:18 AM
SEO implement? - by El Forum - 04-27-2010, 09:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB