0
你好,我有这个网址http://localhost/index.php?a=group&name=groupname
我想它看起来像http://localhost/group/groupname
其中A =是动态的,名称相同thing.For htaccess的重写规则
你好,我有这个网址http://localhost/index.php?a=group&name=groupname
我想它看起来像http://localhost/group/groupname
其中A =是动态的,名称相同thing.For htaccess的重写规则
尝试:
RewriteEngine On
RewriteRule ^([^./]+)/groupname/?$ /index.php?a=$1&name=groupname [QSA,NC,L]
这将改写:
到
编辑:
如果组名也是中对动态,则在PATTEN,只需用替换组名([^ /] +)并替换name = groupname with name = $ 2在目标路径中。
会保留/ foo/groupname吗? – FoGsY
我需要group和groupname都是变量。不是groupname常数 – FoGsY
@FoGsy请参阅编辑。 – starkeen