.htaccess 此htaccess多级目录重写规则有什么问题?

.htaccess 此htaccess多级目录重写规则有什么问题?,.htaccess,mod-rewrite,multi-level,.htaccess,Mod Rewrite,Multi Level,我的htaccess有一些问题 我希望我的url如下所示: http://example.com/artist/ http://example.com/artist/rihanna/ http://example.com/artist/rihanna/biography/ http://example.com/artist/rihanna/video/ http://example.com/artist/rihanna/news/ 问题在于url的所有工作,除了“http://example.

我的htaccess有一些问题

我希望我的url如下所示:

http://example.com/artist/
http://example.com/artist/rihanna/
http://example.com/artist/rihanna/biography/
http://example.com/artist/rihanna/video/
http://example.com/artist/rihanna/news/
问题在于url的所有工作,除了“http://example.com/artist/"

这条线

重写规则^artist/([^]*)?$/artist/$1/[R=301,L]

将匹配
http://example.com/artist/
这可能不是您想要的。更改如下

RewriteRule ^artist/([^_/]+)$ /artist/$1/ [R=301,L]

如果这不能完全解决问题,请告诉我结果。

当您尝试访问
http://example.com/artist/
?无论是否有反斜杠,我都会收到一个错误:“页面未正确重定向”现在我不再收到该错误,但我被重定向到“”
example.com/artist/
建议第一个BackerReference
$1
为空。但是,我给您的规则
([^/]+)
不应与空字符串匹配。。。你能验证一下这个规则和你的.htaccess中的规则是一样的吗?我不知道该说什么。。。我在我的第一篇文章中修改了代码,就像你说的。。。那么问题应该是什么呢?这个问题可能是由规则制定的地方造成的吗?我先添加了最后一个(引用artist page.php的那个),现在它可以工作了。。。
RewriteRule ^artist/([^_/]+)$ /artist/$1/ [R=301,L]