0

I'm strugling to make this work. At the moment my .htaccess contains the following code:

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
  # Options +SymLinksIfOwnerMatch

  # Turn on the engine:
  RewriteEngine on

  #RewriteRule ^([\w-]+)/?$ product.php?pid=$1 [L,QSA,NC]
  RewriteRule ^([\w-]+)/([\w-]+)/?$ product.php?pid=$1&pname=$2 [L,QSA,NC]
</IfModule>

My Original URL is something linke this

product.php?pid=1&pname=this is a product name

My clean URL should be something like below:

example.com/1/this is a product name

This is how my <a> tag generate by PHP:

$url = "{$pid}/{$pname}";
$url = html_escape($url, 'UTF-8'); 
echo "<a href='$url'>Link</a>";

Above first rule is working for me. But when I try it with pname variable like I have done in second rule is not working for me.

can anybody tell me what is wrong with this?

user3733831
  • 2,886
  • 9
  • 36
  • 68

0 Answers0