User-friendly URL receiving p/PHP value

Asked

Viewed 48 times

1

My doubt lies in this URL:

site.com/embed.php?id=a48sa4d2a3s4d65a1s5d6a1sd56

I get that amount for $_GET['id'].

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

site.com/embed/a48sa4d2a3s4d65a1s5d6a1sd56

I want to remove this parameter ?id=.

I’ve managed to remove the .php with .htaccess.

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 code block in your .htaccess, just copy the rule line.

Source (for example): /a/86900/45810

Browser other questions tagged

You are not signed in. Login or sign up in order to post.