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
有帮助吗?

解决方案

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

其他提示

You need to use URL rewriting.

Please check the Apache URL Rewriting Guide.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top