Friendly URL getting value for PHP

1

My question is in this URL :

site.com/embed.php?id=a48sa4d2a3s4d65a1s5d6a1sd56

I get this value for $_GET['id'] .

How can I turn into a beautiful and organized URL ? Example:

site.com/embed/a48sa4d2a3s4d65a1s5d6a1sd56

I want to remove this parameter ?id= .

I've already been able to remove .php with .htaccess .

    
asked by anonymous 10.12.2018 / 02:34

1 answer

2

Add this to your .htaccess :

<IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteRule ^embed\/([0-9A-z_-]+)$ embed.php?id=$1 [QSA,L,NC]

</IfModule>

If you already have this block of code in your .htaccess , just copy the rule line.

  

Source (example): link

    
10.12.2018 / 02:49