Hello, I have got a website which is PHP and Mysql driven. And the address of a particular product goes like: product.php?parent_id=5&product_id=10.... If the product name is let's say: ipod nano 1 gb, how can I make the link address look like: product.php/ipod-nano-1-gb (search engine friendly) or preferable can I get rid of .php or .html in the address completely?
You would need to modify the script to send titles of the products rather then numeric id's. Then you would need to modrewrite the site.
Thank you for the reply. Can you explain more in detail? If I send the title, there will be %20 in the link as there is space which I do not want. I do not know about modrewrite though.
RewriteEngine On RewriteRule ^product/([\w-]+)$ product.php?product_title=$1 Code (markup): With this, you'd have to modify your PHP script to fetch the items by title. Like product.php?product_title=ipod-nano-1-gb And you have to modify the script that generates these links to replace spaces with dashes. $title = preg_replace('~[^\w-]+~', '-', $title); PHP:
I had a similar problem and here's what I did. My product names were url encoded i.e/http://www.somehost.com/search.php?Apple+Ipod/ Good Luck. http://forums.digitalpoint.com/showthread.php?t=652095
Yes ^^ Just use urlencode($var) on the titles being sent, that way it will remove all of the %20 and replace it with a +