How to make SEO friendly URL structure using PHP?

Discussion in 'PHP' started by rahulephp, May 9, 2010.

  1. #1
    Hi,

    I need to send product id with URL something like this:
    http://www.example.com/product.php?id=292&name=sony-digital-camera
    Code (markup):
    But this URL is not good enough for seo.
    Can anyone please let me know how to pass the ids and name (without "product.php") so that I will extract the id later
    http://www.example.com/sony-digital-camera-292.php
    Code (markup):
    All the operation takes place at "product.php" so I can't ignore it.
    But I don't want "product.php" page to be shown in URL.

    After rendering "product.php" page with respective product id, I'll get all of the parameters like name, price, description etc.
    Then now the URL of page would have to be (like this)
    http://www.example.com/sony-digital-camera-292.php
    Code (markup):
    (without "product.php")

    Thank you in anticipation
     
    rahulephp, May 9, 2010 IP
  2. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #2
    Sky AK47, May 9, 2010 IP
  3. Blindkilla

    Blindkilla Active Member

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    80
    #3
    It's even easier to do if you are programming with a framework like Zend.
     
    Blindkilla, May 10, 2010 IP
  4. abstractworld

    abstractworld Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You will need to use mod_rewrite. Depending upon the structure of your urls you need to write some lines in .htaccess file.
     
    abstractworld, May 11, 2010 IP