把规则改成这样试试
RewriteRule ^/([^/]+)/([^/]+)-([^/]+)_([^/]_)+\.html$ /$1/$2.php?$3=$4 [L]

解决方案 »

  1.   

    其实把
      RewriteRule ^/([^/]+)/([^/]+)-([^/]+)_([^/]+)\.html$ /$1/$2.php?$3=$4 [L]
    改成
      RewriteRule ^/([^/]+)/([^/]+)-([^/]+)-([^/]+)\.html$ /$1/$2.php?$3=$4 [L] 就可用了。但已把所有链接修改成了 detail-username_liubi.html  这个格式,修改的地方太多。所以还是想保持以前的 detail-username_liubi.html 这个格式,只在规则上修改,不知是否可行。
      

  2.   

    一般正则匹配是贪婪模式,可以用?试试看
    RewriteRule ^/([^/]+)/([^/]+)-([^/]+)_([^/]+)\.html$ /$1/$2.php?$3=$4 [L]
    改成
    RewriteRule ^/([^/]+)/([^/]+)-([^/]+?)_([^/]+)\.html$ /$1/$2.php?$3=$4 [L]
      

  3.   

    谢谢各位的回答。以下这个模式的在IIS下可用。但在apache 下却apache 不能启动,提示  "]+)-([^/]+?)_([^/ " ?号哪里有误!RewriteRule ^/([^/]+)/([^/]+)-([^/]+?)_([^/]+)\.html$ /$1/$2.php?$3=$4 [L]apache 如何处理
      

  4.   

    [^/]这个居然不用对/进行转义的?
    楼主,改成这样试试:
    RewriteRule ^/([^/]+)/([^/]+)-([^_]+)_([^/]+)\.html$ /$1/$2.php?$3=$4 [L]
      

  5.   

    最后一个答案终于可以了。谢谢各位朋友。非常感谢zairwolfi(君子兰)的热心与热诚!