0

i have a problem setting up nice urls on my php site and hope you guys can help me out here.

The actual url loooks like this right now: http://www.domain.com/product.php?op=showm&name=the-slug&id=id

I want it to look like this: http://www.domain.com/products/the-slug/id or even better without the id.

Any help appreciated, thanks so much!

Cheers

Christian
  • 11
  • 2

1 Answers1

3

What you want is help from a mod rewrite generator. Here's a good one. http://www.generateit.net/mod-rewrite/index.php

Here is what you can try adding to your .htaccess file, too:

RewriteEngine On
RewriteRule ^products/([^/]*)/([^/]*)$ /product.php?op=showm&name=$1&id=$2 [L]

The original URL: http://www.domain.com/product.php?op=showm&name=the-slug&id=id

The rewritten URL: http://www.domain.com/products/the-slug/id

test
  • 17,706
  • 64
  • 171
  • 244