-2

How do I change the url from product?p=$name to product/$name.

I tied to use the .htaccses file but couldn't figure it out.

The link in php

echo"<a href = 'product?p=$name'></a>";
Pete
  • 57,112
  • 28
  • 117
  • 166
dr_fluff
  • 123
  • 1
  • 1
  • 7
  • 2
    Look what i've found! http://stackoverflow.com/questions/25080835/pretty-urls-with-htaccess – node_modules Mar 02 '17 at 10:49
  • 3
    Possible duplicate of [htaccess rewrite for query string](http://stackoverflow.com/questions/1231067/htaccess-rewrite-for-query-string) – Pete Mar 02 '17 at 10:50
  • Possible duplicate of [Pretty URLs with .htaccess](http://stackoverflow.com/questions/25080835/pretty-urls-with-htaccess) – Swier Mar 02 '17 at 12:12

1 Answers1

1

Try .HTACCESS file again. This time enter following:

RewriteEngine On
RewriteRule ^product/([^/]*)/$ /product.php?p=$1 [L]

Note: I changed product? to product.php? because most likely you have PHP files.

Artis Zel
  • 61
  • 4