我有以下重写规则。您可能会注意到,前 6 条规则与其他规则相冲突。
RewriteRule ^(groups)/([a-z-]+)/(\d+)/?$ index.php?site=$1&ustr=$2&cmd=$3 [L,NC,QSA]
RewriteRule ^(groups)/([a-z-]+)/?$ index.php?site=$1&ustr=$2 [L,NC,QSA]
RewriteRule ^(events)/([a-z-]+)/(\d+)/?$ index.php?site=$1&ustr=$2&cmd=$3 [L,NC,QSA]
RewriteRule ^(events)/([a-z-]+)/?$ index.php?site=$1&ustr=$2 [L,NC,QSA]
RewriteRule ^(users)/([a-z-]+)/(\d+)/?$ index.php?site=$1&ustr=$2&cmd=$3 [L,NC,QSA]
RewriteRule ^(users)/([a-z-]+)/?$ index.php?site=$1&ustr=$2 [L,NC,QSA]
RewriteRule ^([^/]+)/([a-z]+)/(\d+)/?$ index.php?site=$1&cmd=$2&id=$3 [L,NC,QSA]
RewriteRule ^([^/]+)/([a-z]+)/?$ index.php?site=$1&cmd=$2 [L,NC,QSA]
RewriteRule ^([^/]+)/(\d+)/?$ index.php?site=$1&id=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ index.php?site=$1 [L,QSA]
我想同时访问:(
.com/groups/group-name
为了得到$_GET['ustr']
)和
.com/groups/create
(为了得到$_GET['cmd']
)
编辑:我删除了一个不应该在 .htaccess 中的行。