PHP中的友好URL


Friendly URLs in PHP

这是我当前使用的URL路径:

/index.php?pid=211
I want to get the URL path as
/index/211/title of the product 

如何在PHP中创建用户友好的URL?

如何获得"标题"的价值?

问候,

在html代码中,您必须这样写:

<a href='http://www.domain.com/index/211/title-goes-here'>url_text</a>

并在htaccess文件中调整以下内容:

Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteRule ^([a-zA-Z-]+)$ index.php?action=$1 [NC,L]
RewriteRule ^(member)-([0-9-]+)$ index.php?action=member&id=$2 [NC,L]
RewriteRule ^([a-zA-Z-]+)/([a-zA-Z-]+)-([0-9-]+)$ index.php?action=$1&saction=$2&sid=$3 [NC,L]
RewriteRule ^([a-zA-Z-]+)/([0-9-]+)$ index.php?action=$1&id=$2 [NC,L]
RewriteRule ^([0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/(.*).html$ index.php?action=details&id=$1&p1=$2&p2=$3&p3=$4 [NC,L]