Reputation: 466
I'm not really sure if that question made any sense, but basically, if I had a link like this:
site.com/?id=1HLk83I
How do URL shortening services turn the URL into:
site.com/1HLk83I
If you did it like the first URL, you would get that info by using GET and finding 'id'. I have no clue how they do it or if they even do, do that.
I'm not completely sure if I'm even asking the right thing here. I'm just wondering how you can get info from the URL (1HLk83I) and then be able to use it in your code.
Upvotes: 1
Views: 40
Reputation: 38
Use .htaccess file rewrite rule:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(.*)$ index.php?id=$1 [L,NC,QSA]
Then you can access that in index.php file:
echo $_GET['id'];
Upvotes: 1