Pergunta

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
Foi útil?

Solução

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..

Outras dicas

You need to use URL rewriting.

Please check the Apache URL Rewriting Guide.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top