我要重定向 www.example.com/type/name
到 www.example.com/type.php?user=name
{
RewriteRule ^([a-zA-Z0-9_-]+)/type$ type.php?key=$1
RewriteRule ^([a-zA-Z0-9_-]+)/type/$ type.php?key=$1
}
请帮我这件事。
试试这个,希望它可以帮助:
RewriteBase /www.example.com
RewriteEngine On
RewriteRule ^type/(.*)/$ /type.php?user=$1
#OR
RewriteRule ^(.*)/(.*)/$ /$1.php?user=$2
PS:第一种方法仅适用于网址: www.example.com/type/value 的,第二个适用于您的站点前的任何页面: www.example.com/anypage/value 的
PS : The first one works only for the url : www.example.com/type/value ,the second one works for any page in your site ex: www.example.com/anypage/value