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