我的htaccess有些问题......
我想让我的网址像这样:
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/
问题是所有网址的工作除了" http://example.com/artist/"
RewriteRule ^artist/([^_]*)/biography/$ /artist-biography.php?name=$1 [L]
RewriteRule ^artist/([^_]*)/biography?$ /artist/$1/biography/ [R=301,L]
RewriteRule ^artist/([^_]*)/video/$ /artist-video.php?name=$1 [L]
RewriteRule ^artist/([^_]*)/video?$ /artist/$1/video/ [R=301,L]
RewriteRule ^artist/([^_]*)/news/$ /artist-news.php?name=$1 [L]
RewriteRule ^artist/([^_]*)/news?$ /artist/$1/news/ [R=301,L]
RewriteRule ^artist/([^_]*)/$ /artist.php?name=$1 [L]
RewriteRule ^artist/([^_/]+)$ /artist/$1/ [R=301,L]
RewriteRule ^artist/$ /artist-page.php [L]
RewriteRule ^artist?$ /artist/ [R=301,L]
答案 0 :(得分:2)
这一行
RewriteRule ^ artist /([^ _] *)?$ / artist / $ 1 / [R = 301,L]
将匹配http://example.com/artist/
,这可能不是您想要的。将其更改如下
RewriteRule ^artist/([^_/]+)$ /artist/$1/ [R=301,L]
如果没有完全解决问题,请告诉我结果。