user2005646
user2005646

Reputation: 148

Use $_GET for get id for my link

lets say i have a link like that

http://www.example.com/d8ed54

d8ed54 is the id

How i can use $_GET to echo the id

Thank you

Update........

Not possible in my case to use .htaccess RewriteRule because it's already have a one for all the script links..i can't play on it.

However the link http://www.example.com/d8ed54 will work without 404

I need something with php

Upvotes: 0

Views: 638

Answers (2)

CodeTower
CodeTower

Reputation: 6333

Without using mod_rewrite Apache (Assuming you use Apache) will look for a file or directory named d8ed54. I'm afraid it cannot be done without mod_rewrite.

Upvotes: 0

bizzehdee
bizzehdee

Reputation: 21003

put the following in htaccess

RewriteRule (.*) index.php?id=$1

and then you can use $_GET['id'] to get whatever is passed after the /

you can also do this without $_GET and without any extra additions to your htaccess, you can use $_SERVER['REQUEST_URI'] to get the same piece of information.

$id = $_SERVER['REQUEST_URI'];

Upvotes: 2

Related Questions