How to make SEO friendly URL structure using PHP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rahulephp
Forum Commoner
Posts: 28
Joined: Mon Oct 05, 2009 11:05 am

How to make SEO friendly URL structure using PHP?

Post by rahulephp »

Hi,

I need to send product id with URL something like this:

Code: Select all

http://www.example.com/product.php?id=292&name=sony-digital-camera
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

Code: Select all

http://www.example.com/sony-digital-camera-292.php
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)

Code: Select all

http://www.example.com/sony-digital-camera-292.php
(without "product.php")

Thank you in anticipation
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to make SEO friendly URL structure using PHP?

Post by requinix »

It's called URL rewriting and there's a bunch of stuff about it available.
Post Reply