Welcome Guest, Not a member yet? Register   Sign In
Friendly urls... What's your preference?
#8

[eluser]John_Betong[/eluser]
[quote author="tomdelonge" date="1249100095"]So, say for example you have a forum. And you want someone to be able to view a topic. What would you do?:
...
...
...
Your thoughts? Suggestions? Thanks...[/quote]
 
 
I am in the process of trying to resolve this problem and to try and increase my SEO "brownie points".
1. I used to have "...com/joke/view/123/
2. changed to this "...com/joke/show/123/
3. then changed to "...com/joke/show/this_is_a_funny_joke/123
4. later changed to ...com/joke/_of_the_day/this_is_a_funny_joke/123

Items 1,2 and 3 are now redirected to '/joke/of_the_day/'

My controller code:
Code:
//=============================================
//
//  ensure parameters are in the correct order
//
//=============================================
function of_the_day($joke_title='Joke_of_the_day', $joke_idx = 123456)
{
  // ensure at least one parameter is numeric
  // make into the correct order
  if (is_numeric($joke_title))
  {
    $joke_idx = $joke_title;
    $data     = $this->m_lib->m_getjoke(NULL, $joke_idx);
        
    $joke_title    = url_title($data['joke_title'], '_');
        
    // now put in the correct order and permanently redirect
    redirect('/joke/of_the_day/' .$joke_title .'/' .$joke_idx, 'location', 301);
    exit;
  }else{
    $data = $this->m_lib->m_getjoke(NULL, $joke_idx);
    /* // results
      [joketitle]  => Joke of the day
      [joke_title] => Did you know
      [joke_id]    => 946        
      [joke_memo]  => Michael Jordan having "retired," with $40 million ...  
    */
  }    
  // remove trailing slash to make consistent with Googles "Duplicate meta descriptions"
  $data['joke_id']    = str_replace ('/', '', $data['joke_id']);
            
  $this->j_view($data);
}//endfunc
 
 
 
 


Messages In This Thread
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 05:14 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 05:48 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 05:52 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 06:04 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 06:08 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 06:14 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 06:32 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 07:06 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 07:20 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 07:47 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 07:50 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 10:20 PM
Friendly urls... What's your preference? - by El Forum - 07-31-2009, 10:35 PM
Friendly urls... What's your preference? - by El Forum - 08-01-2009, 03:07 PM
Friendly urls... What's your preference? - by El Forum - 08-02-2009, 11:55 AM
Friendly urls... What's your preference? - by El Forum - 08-02-2009, 02:42 PM
Friendly urls... What's your preference? - by El Forum - 08-02-2009, 03:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB