Url rewriting url重写包含点和下划线的地址

Url rewriting url重写包含点和下划线的地址,url-rewriting,Url Rewriting,链接 <a href='/'>Home</a> <a href='/contact'>Contact</a> <a href='/johnsmith'>Profile 1</a> <a href='/john.smith'>Profile 2</a> <a href='/john_smith'>Profile 3</a> <a href='/john-smith'>

链接

<a href='/'>Home</a>
<a href='/contact'>Contact</a>
<a href='/johnsmith'>Profile 1</a>
<a href='/john.smith'>Profile 2</a>
<a href='/john_smith'>Profile 3</a>
<a href='/john-smith'>Profile 4</a>
<a href='/1_john.smith_1'>Profile 5</a>
RewriteEngine On
RewriteRule ^([a-z]+)/?$    index.php?view=$1  [NC,L]
RewriteRule ^([a-z0-9_-]*[\.]*[a-z0-9_-]+)/?$    index.php?view=profile [NC,L]

问题是只应用了第二条规则
意味着无论我单击哪个链接,它都会转到
index.php?view=profile

请告诉我使用该规则的正确方法第一条规则将匹配第二条和第三条链接,只有这些链接只包含您实现的规则所要求的小写字母

无论何时您在重写方面遇到困难:使用重写日志!您需要mod_rewrite提供的两个命令
RewriteLog
RewriteLogLevel
。然后,模块会详细说明它在内部做什么。哦,请告诉我如何做:(我确实在上面告诉过你。阅读重写模块附带的优秀手册。只有在这之后你有问题,然后在这里提问:-)但第二条规则是匹配所有链接,这就是我的问题,这不能用你使用的正则表达式来解释。所以请接受我的建议:使用日志记录。其他一切都在黑暗中挖掘。。。