我有以下重写。您可能会注意到,前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中的行。