Question

I am having a list of members in my database, which i want to display in my website.

I am using php GET method, and the sample url is

com/members.php?id=454418

Can anyone please help me in getting url like

com/members/454418/steve-jobs
Was it helpful?

Solution

You can use .htaccess file..

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

in this example:

com/members/454418

$_GET['url'] = 454418

give it a try..

OTHER TIPS

You need to use URL rewriting.

Please check the Apache URL Rewriting Guide.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top